So here are some pictures of the setup I have with an LED, 330 Ohm resistor, Arduino UNO, 2 XBee S1s, and many wires,
For specifics, here is the wiring,
-XBee Pin 1 (VCC) is connected to Arduino Uno Pin 3.3V
-XBee Pin 2 is connected to Arduino Uno Pin 1 (TX)
-XBee Pin 3 is connected to Arduino Uno Pin 0 (RX)
-XBee Pin GND is connected to the minus column on the breadboard.
-Arduino Uno Digital Pin 9 is connected to a 330 ohm resistor which is connected to an LED that is -connected to the minus column on the breadboard
-Arduino Uno Pin GND is connected to the minus column on the breadboard
-And lastly I have another XBee connected to my laptop through a USB dongle
I'm trying to send data in the form of bits through my computer using a program called XCTU to turn the LED on and off. Here is the code for the Arduino,
int led = 9;
int bufferSize = 100;
byte readBuffer[100];
byte lastByte = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
}void loop() {
// put your main code here, to run repeatedly:
int toRead = Serial.available();
if(toRead > 0){
while(toRead > bufferSize){
Serial.readBytes(readBuffer, bufferSize);
toRead = toRead - bufferSize;
}Serial.readBytes(readBuffer, toRead);
lastByte = readBuffer[toRead - 1]; //reads last big in serial inputif(lastByte == '1'){
digitalWrite(led, HIGH);
}
else if(lastByte == '0'){
digitalWrite(led, LOW);
}
}
delay(250);
}
However, when I send a '0' through XCTU, the LED doesn't turn off. What could be causing this? Note that I did not use a shield to connect the XBee to the Arduino Uno, I soldered the pins to the appropriate spots because I thought it was possible after watching this video, https://www.youtube.com/watch?v=wtal7SWZek0
Also, I'm cross-posting this on arduino stack exchange to get as much input on this as possible. I'll keep both topics updated to attribute answerers from both sites accordingly (Unable to send serial data to XBee connected to Arduino Uno without a shield - Arduino Stack Exchange)