Right now I basically assembled all parts of the board and the Cubetto but it looks like the wireless communication is not working.
List of Problems:
- Cubetto did not initialize. I could hear the motors stutter but they would not move. Looks like the 4 AA batteries don’t deliver enough juice. Now I’m temporary using an old cell phone charger to deliver the power. No more wireless đ but it helps me troubleshooting.
Might have to go for LiPo batteries. - I then tried it out with the XBees installed on the Mega and the Uno (via Wireless sd shields) respectively. But nothing happened.
Looking at the board’s output over serial I can see that the commands are being sent. And when connecting to Cubetto using the USB cable it also initializes correctly and executes commands that I send from the laptop via serial.
So I made a step back and just wanted to setup a basic XBee connection between the two Arduinos:
I came across this tutorial from Instructables but it is not working for me.
Setup
Transmitter:
– Mega 2560
– Arduino Wireless Protoshield SD
– XBee 2mW Wire Antenna – Series 2 (ZigBee Mesh)
Code:
void setup() { // initialize serial communication: Serial.begin(9600); } void loop(){ delay(1000); Serial.println('h'); delay(1000); }
I have the switch on the shield on “USB” while uploading and can see “h”‘s printed in the serial window after uploading. Switching to “Micro” after that.
Receiver:
– Uno R3
– Arduino Wireless Protoshield SD
– XBee 2mW Wire Antenna – Series 2 (ZigBee Mesh)
Code:
int sentDat; void setup() { Serial.begin(9600); pinMode(2, OUTPUT); } void loop() { if (Serial.available() > 0) { sentDat = Serial.read(); if(sentDat == 'h'){ digitalWrite(2, HIGH); delay(1000); digitalWrite(2, LOW); } } }
Again, having the switch to USB when uploading and seeing the led blink when sending an “h” over serial. Then switching to “Micro”.
And then: Nothing!
How can I troubleshoot this? Any help appreciated.
[UPDATE]
I yanked the shield from the Mega and crossed tx/rx from the Mega to the shield. I also connected the 6 isp connections plus 5v, 3.3v and GND.
I then connected Mega’s rx with Uno’s rx and tx with tx with wires and my blink sketch worked!
I had the switches on the shields both to USB.
But then, when I remove the rx/tx wires the communication is dead. I switched the shield to Micro mode and back to USB, i played around with switching rx / tx… but no luck.
Not sure if I need to make more connections from the Mega to the shield… unfortunately it’s not on shieldlist.org.
[/UPDATE]