Download presentation
Presentation is loading. Please wait.
Published byGiles Butler Modified over 9 years ago
1
Basic Circuits – Lab 5 Wireless Networking Xmedia Spring 2011
2
Agenda Xbee –Setup Arduino –Soft Serial Arduino and Processing –Protocol –OSC Messages
3
Xbee – Setup Command Mode and AT Commands Serial Terminal – Coolterm (mac, windows)macwindows +++Enter Command Mode ATIDPersonal Area Network ID – shared by all xbees on the network ATDLDestination Address – what Xbee this one sends data to ATMYSource address – what DL refers to ATWRWrite values to memory ATCNExit Command Mode
4
Arduino – Soft Serial #include //SoftwareSerial mySerial(rxPin, txPin); SoftwareSerial mySerial(2, 3); void setup() { Serial.begin(9600); Serial.println("Goodnight moon!"); // set the data rate for the SoftwareSerial port mySerial.begin(9600); mySerial.println("Hello, world?"); } void loop() { if (mySerial.available()>0) { int inData = mySerial.read(); Serial.println(“Data Received” + inData); mySerial.println(“Soft Serial”); } Connect rx (receive) from xbee to Arduino Pin 3 (transmit) Connect tx (transmit) from xbee to Arduino Pin 2 (receive) New soft serial library - http://arduiniana.org/2011/01/newsoftserial-11-beta/
5
Arduino and Processing – Protocol 1.Processing broadcasts a string to all puppets. 2.Puppets check the string to see if it is their address. 3.If the string refers to the puppet, the puppet sends its data to the computer. 4.Processing constructs an OSC message from the data from the puppet. 5.Processing sends the OSC message to Unity. 6.Processing requests data from the next puppet.
6
Protocol – Sample Arduino Code void loop() { if (mySerial.available()>0) { while (mySerial.available() > 0) { addressChar = char(mySerial.read()); address += addressChar; } Serial.println(address); if (address.equals( "One" )) { mySerial.print("Xbee1"); } address = ""; delay(100); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.