import machine
import esp32
import time
while True:
print(machine.freq()) ##動作周波数
print(esp32.raw_temperature()) ##温度
time.sleep(1)
from machine import TouchPad, Pin
import esp32
import time
## t = TouchPad(Pin(0))
## t = TouchPad(Pin(2))
## t = TouchPad(Pin(12))
## t = TouchPad(Pin(15))
t = TouchPad(Pin(33))
while True:
print(t.read())
# タッチすると小さい数値を返す
time.sleep(1)
from display import Pixel, PixelPower
PixelPower(True)
View = Pixel()
# RGB = (10, 10, 10)
# RGB = (1, 1, 1)
# RGB = ( 10, 0, 10 )
RGB = (0, 0, 0)
View.LoadXY(1, 1, RGB)
View.LoadPos(23, RGB)
View.Show()
from machine import Pin
p0 = Pin(0, Pin.OUT) # GPIO 0 の出力ピンを作成
p0.on() # ピンを "on" (high) レベルに設定
p0.off() # ピンを "off" (low) レベルに設定
p0.value(1) # ピンを on/high に設定
p2 = Pin(2, Pin.IN) # GPIO 2 の入力ピンを作成
print(p2.value()) # 値 0 または 1 を取得
p4 = Pin(4, Pin.IN, Pin.PULL_UP) # 内部プルアップ抵抗を有効化
p5 = Pin(5, Pin.OUT, value=1) # 作成時にピンを high に設定
print("TEST end")
from microbit import *
# p0 = pin0.read_analog()
while True :
p0 = pin0.read_analog()
if p0 < 60 :
display.show(Image.HAPPY)
pin1.write_digital(0)
elif (60 < p0) and ( 90 > p0 ):
display.show( Image.ASLEEP)
elif (60 < p0) and (100 > p0) :
display.show(Image.ANGRY)
else :
display.show(Image.SAD)
pin1.write_digital(1)
# print ( p0 )
# ここにコードを書いてね :-)
from microbit import *
from machine import Pin
p35 = Pin(35,Pin.IN)
p27 = Pin(27,Pin.IN)
while True :
sleep(500)
print ( button_a.is_pressed() )
print ( button_b.is_pressed() )
sleep(500)
print (p35.value())
print (p27.value())