(Let me just start off by saying that i am very new to arduino. I'm probably scanning over something very obvious). A few days ago I made sketch that allows the arduino to communicate with a wii nunchuck:
#include <Wire.h>
#include "nunchuck_funcs.h"
int loop_cnt=0;
byte accx,accy,zbut,cbut,xjoy,yjoy;
int ledPin = 13;
void setup()
{
Serial.begin(9600);
nunchuck_setpowerpins();
nunchuck_init(); // send the initilization handshake
Serial.print("WiiChuckDemo ready\n");
}
void loop()
{
if( loop_cnt > 100 ) { // every 100 msecs get new data
loop_cnt = 0;
nunchuck_get_data();
accx = nunchuck_accelx(); // ranges from approx 70 - 182
accy = nunchuck_accely(); // ranges from approx 65 - 173
zbut = nunchuck_zbutton();
cbut = nunchuck_cbutton();
xjoy = nunchuck_joyx();
yjoy = nunchuck_joyy();
Serial.print("accx: "); Serial.print((byte)accx,DEC);
Serial.print("\taccy: "); Serial.print((byte)accy,DEC);
Serial.print("\tzbut: "); Serial.print((byte)zbut,DEC);
Serial.print("\tcbut: "); Serial.print((byte)cbut,DEC);
Serial.print("\tyjoy: "); Serial.print((byte)xjoy,DEC);
Serial.print("\txjoy: "); Serial.println((byte)yjoy,DEC);
}
loop_cnt++;
delay(1);
}
Now as you can see, this sketch has multiple variables. I want to be able to transmit all of these variables to another arduino via xbee. I've learned to control one variable through xbee (I would send 'L's and 'H's from one arduino in order to change the value of a variable on another arduino, which would turn an LED on and off.) but I am having trouble controlling more than one. Essentially what I want to do is transmit all 6 of these values to the other arduino (the one without the nunchuck) where they will each be assigned to a different variable. Once again, I'm very new to arduino so please try to dumb it down as much as possible.