33 lines
473 B
Python
Raw Normal View History

2021-09-08 21:25:52 +08:00
import PikaStdLib
import STM32
mem = PikaStdLib.MemChecker()
io1 = STM32.GPIO()
time = STM32.Time()
2021-09-09 08:40:13 +08:00
adc1 = STM32.ADC()
2021-09-08 21:25:52 +08:00
io1.init()
io1.setPin('PB4')
io1.setMode('out')
io1.enable()
io1.low()
2021-09-09 08:40:13 +08:00
adc1.init()
adc1.setPin('PA1')
adc1.enable()
2021-09-08 21:25:52 +08:00
print('hello pikascript')
print('mem.max :')
mem.max()
print('mem.now :')
mem.now()
while True:
io1.low()
time.sleep_ms(500)
io1.high()
time.sleep_ms(500)
2021-09-09 08:40:13 +08:00
val = adc1.read()
print('adc1 value:')
print(val)