90 likes | 201 Vues
This presentation explores the intricacies of Bluetooth communication within robotics projects, focusing on effective message transmission and reception strategies. Key elements include the need for timing consistency and correct datatype handling while communicating. The example demonstrates a master/slave architecture where messages are sent upon sensor input, with visual feedback displayed on an NXT interface. Practical suggestions for optimizing performance, such as creating modular code with MyBlocks and conducting small experiments, are included to enhance understanding and implementation of Bluetooth functionalities.
E N D
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
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 MyBlocks • Experiment with pauses. More or less may be better. • ?
Building projects • Do small experiments • Write out plans (logic) • Iterate