Your TinkerPy App sends data (one character) when you tap a widget — for example a Switch sends S for ON and s for OFF. The board reads it with bluetooth_read_char().
import bluetooth setup: bluetooth_begin() # switches Bluetooth on when the board starts loop: bt = bluetooth_read_char() if bt == 'S': o1 = pwm(100) elif bt == 's': o1 = 0
Sending to the app
bluetooth_write("A") sends data to the app. An output widget — like Fire — changes when its data arrives.
import bluetooth setup: bluetooth_begin() # switches Bluetooth on when the board starts loop: if i2 == ON: bluetooth_write("A") o1 = pwm(100) else: bluetooth_write("a") o1 = 0 wait(500)
💡 Tip
Open the App lessons to build the app for this code!