Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <DIYables_IRcontroller.h> // DIYables_IRcontroller library
- #define IR_RECEIVER_PIN 7 // The Arduino pin connected to IR controller
- #define LeftLeg 2
- #define RightLeg 3
- #define LeftFoot 4
- #define RightFoot 5
- #define Otto.init(LeftLeg, RightLeg, LeftFoot, RightFoot, true, Buzzer); //2,3,4,5
- DIYables_IRcontroller_17 irController(IR_RECEIVER_PIN, 200); // debounce time is 200ms
- void setup() {
- Serial.begin(9600);
- irController.begin();
- }
- void loop() {
- Key17 command = irController.getKey();
- if (command != Key17::NONE) {
- switch (command) {
- case Key17::KEY_1:
- Serial.println("1");
- // TODO: Otto.moonwalker(3, 1000, 25,1); //LEFT
- break;
- case Key17::KEY_2:
- Serial.println("2");
- // TODO: Otto.moonwalker(3, 1000, 25,-1); //RIGHT
- break;
- case Key17::KEY_3:
- Serial.println("3");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_4:
- Serial.println("4");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_5:
- Serial.println("5");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_6:
- Serial.println("6");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_7:
- Serial.println("7");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_8:
- Serial.println("8");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_9:
- Serial.println("9");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_STAR:
- Serial.println("*");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_0:
- Serial.println("0");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_SHARP:
- Serial.println("#");
- // TODO: YOUR CONTROL
- break;
- case Key17::KEY_UP:
- Serial.println("UP");
- // TODO: Otto.walk(2,1000,1); //2 steps, "TIME". IF HIGHER THE VALUE THEN SLOWER (from 600 to 1400), 1 FORWARD YOUR CONTROL
- break;
- case Key17::KEY_DOWN:
- Serial.println("DOWN");
- // TODO: Otto.walk(2,1000,-1); //2 steps, T, -1 BACKWARD
- break;
- case Key17::KEY_LEFT:
- Serial.println("LEFT");
- // TODO: Otto.turn(2,1000,1);//3 steps turning LEFT
- break;
- case Key17::KEY_RIGHT:
- Serial.println("RIGHT");
- // TODO: Otto.turn(2,1000,-1);//3 steps turning RIGHT
- break;
- case Key17::KEY_OK :
- Serial.println("OK");
- // TODO: Otto.home();
- break;
- default:
- Serial.println("WARNING: undefined command:");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement