Programme de contrôle du robot MRduino avec une télécommande :
#include <mrduino.h>
int reception;
void setup()
{
// init serial communication
Serial.begin(115200);
}
void loop()
{
// read IR reception sensor
reception = irReceiver();
// read command
switch(reception)
{
case 2:
forward(30);// Forward
break;
case 6:
turnRight(30);// turn right
break;
case 4:
turnLeft(30);// turn left
break;
case 8:
back(30);// back
break;
case 5:
stop();// stop
break;
}
}
