XBee shield to Xbee Shield Communication


hello arduino community,
i new user community working arduinos. have little background in c else still pretty fresh me. ok let me point. have 2 arduino duemilanove board each xbee shield , xbee module attached. followed tutorial send 'h' or 'l' second arduino changes internal led on receiving board on , off. got part work fine when try send number or data, ascii value characters being sent.
so asking there anyway can send float value transmitting arduino , receive same number @ second arduino , view number on serial monitor? been messing while , searching through forums. appreciated. thank in advance. know that number coming in on pot first code 0-1023. can view number on serial monitor. want able view same number on serial monitor of second arduino.
-marcus
here's code:
tx arduino
void setup() {
   serial.begin(9600);
}

void loop() {
   int analogvalue = analogread(a3) ;
   serial.print(analogvalue);               
   serial.println();                 
   delay(1000);
}

rx arduino
int incomingbyte;
void setup() {
  serial.begin(9600);
}

void loop() {
  if (serial.available() > 0) {
    incomingbyte = serial.read();
    serial.print(incomingbyte);
    serial.println();
  }
}

quote
i got part work fine when try send number or data, ascii value characters being sent.

depends on how send data.

serial.print() sends characters or character representations of value. serial.write() sends binary data.

quote
so asking there anyway can send float value transmitting arduino , receive same number @ second arduino , view number on serial monitor?

yes. see above. keep in mind serial.write() sends 1 byte, or 1 array of bytes, @ time, , float 4 bytes, must cast float byte pointer , send 4 bytes.

there few real uses floats on arduino, though. so, why (think you) need send floats?


Arduino Forum > Using Arduino > Programming Questions > XBee shield to Xbee Shield Communication


arduino

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO