Robotics Bluetooth example Presentations Lab building projects Bluetooth
Robotics Bluetooth example Presentations Lab: building projects
Bluetooth and all communication protocols • Subject to timing variability. Sends and receives done on digital schedule, not continuously • Message transmission is not instantaneous
My example • keybt – Runs on master – Loop: Waits for touch sensor, NXT left arrow, or NXT right arrow • When one is pressed, send BT 1, 2, or 3 • Displays number • getmsg – Runs on slave. Must be started first. – Loop to receive BT numeric message • Displays message
keybt
keybt
getmsg
Cautions • Make sure sending and receiving same datatype, in this case number – Also correct connection, correct mailbox. In this case, 1 (only connection) and 1. • The nbr variable initialized and reset to zero is used to signal if something has been pressed AND what has been pressed. – advantage of numbers – comparing numbers built in • There are text operations that can be downloaded from nxtasy: http: //nxtasy. org/2007/05/30/text-manipulation-nxt-g-blocks/
Suggestions (Do as I say, not as I just did…) • Make multiple block sections for display into My. Blocks • Experiment with pauses. More or less may be better. • ?
Building projects • Do small experiments • Write out plans (logic) • Iterate
- Slides: 9