I am trying to send numbers from my serial monitor (1, 2, 3, 4, 0) to my Arduino that is hooked up to some motors. I have been trying for hours to find only random characters and symbols popping up in the monitor. I am using the XBee Pro S1 on both my computer and Arduino. Any help is much appreciated for this newbie.
Code:
void loop() {
if (Serial.available() > 0) {
int input = Serial.read(); // I have tried many things here like char, byte, (char) casts
Serial.write(input); // this just writes random symbols and letters/numbers
if (input == 1) {
forward();
}
if (input == 2) {
backward();
}
if (input == 3) {
left();
}
if (input == 4) {
right();
}
if (input == 0) {
kill();
}
}
}
Here is an example of the crazy responses I get. Note that the response changes every time I send 2.
Let me know if you need more information. Thanks again.
I am using the XBee Pro S1 on both my computer and Arduino.
Is the output from the computer TTL?
zoomkat:
Is the output from the computer TTL?
How would I know that? I have tried using VB.Net and the Arduino Serial Monitor. I am using the Adafruit USB Explorer kit.
I changed the baud rate to 57600 and changed Serial.begin(9600); to Serial.begin(57600);. Now I get no response.
How would I know that? I have tried using VB.Net and the Arduino Serial Monitor. I am using the Adafruit USB Explorer kit.
Specifically how is the pc connected to its XBee? If it is some how connected using a a USB serial adapter, the USB serial adapter may be outputting rs232 instead of TTL.
zoomkat:
Specifically how is the pc connected to its XBee? If it is some how connected using a a USB serial adapter, the USB serial adapter may be outputting rs232 instead of TTL.
This is the adapter I have. I do not think it says anything about TTL or RS232z
prattcmp:
Any help with this?
The link you provided appears to show links to the adafruit forum which might have quick answers for your questions.
zoomkat:
The link you provided appears to show links to the adafruit forum which might have quick answers for your questions.
I asked them if it was TTL. No answer. I also have a DFRobot IO Expansion Shield V7.1, so I am wondering if that is the issue. Maybe it needs to use SoftwareSerial. I saw something about jumpers. Any ideas?