Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## ภาคส่งสัญญาณควบคุม NeoPixel
- ## 2. ควบคุม NeoPixel ทั้งจำนวนการติด ความสว่าง และ สี จาก micro:bit อีกชุด
- from microbit import *
- import radio
- radio.on()
- radio.config(channel=42)
- radio.config(power=7)
- x=True
- y=True
- while True:
- if button_a.was_pressed():
- if x: x=False
- else: x=True
- if x:
- VR2 = pin2.read_analog()
- msg = "C,{:04d}".format(VR2)
- radio.send(msg)
- display.show('C')
- print(msg)
- sleep(100)
- else :
- VR1 = pin1.read_analog()
- msg = "L,{:04d}".format(VR1)
- radio.send(msg)
- display.show('L')
- print(msg)
- sleep(100)
- if button_b.was_pressed():
- radio.send('B,1')
- print('B,1')
- display.show('B')
- sleep(200)
- radio.send('B,0')
- print('B,0')
- sleep(200)
Advertisement
Add Comment
Please, Sign In to add comment