Hi
I have a Zumo Robot with 75:1 HP Motors.
Im mounting an extra IR Sensor on port 2, using this tutorial:
learn.adafruit.com/ir-sensor/using-an-ir-sensor
If the Zumo and Arduino UNO is only using the code provided in the tutorial, it works just fine. However, when I try to add the code to, for example, MazeSolver, It gets stucked here:
[code]void loop(void) {
uint16_t highpulse, lowpulse; // temporary storage timing
highpulse = lowpulse = 0; // start out with no pulse length
// while (digitalRead(IRpin)) { // this is too slow!
while (IRpin_PIN & (1 << IRpin)) { +++++++++++++++++STUCK HERE++++++++++++++++++++++++
// pin is still HIGH[/code]
this is my loop
[code]void loop()
{
int numberpulses;
numberpulses = listenForIR();
Serial.println(“listened”);
// solveMaze() explores every segment
// of the maze until it finds the finish
// line.
if (IRcompare(numberpulses, IRPlaySignal, sizeof(IRPlaySignal) / 4)) {
Serial.println(“PLAY”);
solveMaze();
}
if (IRcompare(numberpulses, IRStopSignal, sizeof( IRStopSignal) / 4)) {
Serial.println(“STOP”);
motors.setSpeeds(0, 0);
}
delay(100);
// Sound off buzzer to denote Zumo has solved the maze
buzzer.play(">>a32");
}[/code]
What Im trying to achieve is using a TV Remote, controlling the stop/go from the Zumo Robot.
By the way the code is getting stuck, I believe it has something to do with PORTD. BTW Im using PIN 2 for the IR Sensor. Correct me if Im wrong, but for a setup with IR Array, no LEDON, Buzzer, the pins go like this:
IR bottom sensors (5, A2, A0, 11, A3, and 4)
pushbutton digital pin 12
motor driver digital pin 7, 8, 9, 10
buzzer digital pin 3
free 2,6,A1, A2, A4, A5