• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Zigbee arduino -serial communication help

Not open for further replies.
I am workng on this project

code : http://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand/step6/CODE/

Although the code is there in this link .but i made a completly different code...beacuse using map was not giving precise results so i made mapping function for each flex seperatly.In this code(given in link above) if(Serial.available() >=5) is used...I am working on serial communication for the first time..so I am not able to understand how serial communication using zigbee occur.. Does it send data in string ?
I tried sending 5 numbers by using serial.available.."152 689 356 123 124"
then it printed 1 5 2 6 8. so i think data in string form is send...
here is my code (attached herewith)
I am not using default rx tx pin here....but using 0 and 1 as rx tx also give the same result...
Pleas help me out with what is wrong with this code..(random data is received by this code)


Well i was hoping for solution...but i solved it by myself..so here it is.
if (Serial.available() > 2) // for 3 digit number...if 4 didgit number then serial.avaialable()>3
// read the incoming byte:
incomingByte = Serial.read();
x= (incomingByte-48)*100; // to convert ascii value to integer digit
if (x>=899) // two digit number 24 is send as 900 + 24 =924
// Serial.println(incomingByte);
incomingByte = Serial.read();
x=x+((incomingByte-48)*10); // string to int conversion
// Serial.println(incomingByte);
incomingByte = Serial.read();
Not open for further replies.

Latest threads

EE World Online Articles