Hi there,
i've been working on some basics and intermediate applcations using XBEE
(basically, what i do is to plug an XBEE via an EXPLORER on a PC, and use it to send data. this data is received on an arduino+xbee, and then i process them.
I can easily toggle led, turn on motors etc.. this works well)
now i'm working on processing joysticks and many keybuttons ( i'm controlling an uav using the method mentionned above ), and now i'm thinking about what could be the best method in order to get the incoming data the more accurate and the more efficient way.
These are the two ideas i came with:
____ PC + PROCESSING the controller:
i process the keys and sticks, write it to the xbee which send them to the other xbee.
this is an example of code:
// "A" is pressed
XBEE.write ('A')
delay(50); // this works well, very accurate and i get fast answers,
// a stick is pressed
XBEE.write('Y') ; // tells the arduino the next data concerns the Y axis
XBEE.write( ValY ) ; // ValY is the value i get by using processing code like : ValY = Y.getValue ();
this works well too.
my problem concerns the other side, the arduino:
___ arduino ( xbee receiver ):
i plug an xbee using only essential PINS ( 1 = Vcc, 2 = Data In , 10 = Gnd ), pin 2 connected to RX0 ( main serial of the board )
this is an example of code:
void setup(){
Serial.begin (9600); // same BD as XBEE
}
void loop (){
processdata(); // i think it is better to process out of the loop, may be wrong or useless
}
void processdata(){
}