Arduino & xbee tutorial - transmit from seperate arduino wirelessly to pc or mac

Аватар автора
Soulful Music Reviews
Something i found difficult to begin with, as there were not that many tutorials. This is a quick example including code to get an arduino with xbee shield, talking to a separate arduino - atmel board, connected to usb. I use a potentiometer as a way of verifying the code is working and that it is correctly transmitting. sorry about the audio - i took this with my g2 this is the code without the extra bits not needed in the tutorial (shortened) int ledPin = 0; // select the pin for the analog port 0 int val = 0; // variable to store value coming from sensor void setup() { Serial.begin(2400); } void loop() { val = analogRead(ledPin); // read value from sensor sendValue (val); delay(100); // stop the program for some time } void sendValue (int val){ //new function Serial.print(val); //print value to xbee (serial port) Serial.print(" "); //print a space so we can see }

0/0


0/0

0/0

0/0

0/0