aboutsummaryrefslogtreecommitdiff
path: root/libraries/Robot_Control/examples/explore/R08_Remote_Control
diff options
context:
space:
mode:
authorFede85 <f.vanzati@gmail.com>2013-07-03 22:00:02 +0200
committerFede85 <f.vanzati@gmail.com>2013-07-03 22:00:02 +0200
commitfd8c367304fe62a107332db19880c88f9ac0d082 (patch)
treea6a2713b1e788a2eb6f95ef701a0a01e0d258c67 /libraries/Robot_Control/examples/explore/R08_Remote_Control
parentcb3003082e7e140850071eba914c0b4347bc3bf1 (diff)
SPI library to the new format and moved Robot_Motor and Robot_Control libraries
Diffstat (limited to 'libraries/Robot_Control/examples/explore/R08_Remote_Control')
-rw-r--r--libraries/Robot_Control/examples/explore/R08_Remote_Control/R08_Remote_Control.ino123
1 files changed, 0 insertions, 123 deletions
diff --git a/libraries/Robot_Control/examples/explore/R08_Remote_Control/R08_Remote_Control.ino b/libraries/Robot_Control/examples/explore/R08_Remote_Control/R08_Remote_Control.ino
deleted file mode 100644
index fda21cb..0000000
--- a/libraries/Robot_Control/examples/explore/R08_Remote_Control/R08_Remote_Control.ino
+++ /dev/null
@@ -1,123 +0,0 @@
-/* 08 Remote Control
-
- *******************
- ***
- ***This example code is in an experimental state.
- ***You are welcome to try this with your robot,
- ***and no harm will come to it. We will provide a
- ***detailed description of an updated version of this
- ***in a future update
- ***
- *** For this example to work you need:
- ***
- *** - download and install the IR-Remote library by Ken Shirriff
- *** to be found at https://github.com/shirriff/Arduino-IRremote
- *** - get a Sony remote control
- ***
- *** This example will be updated soon, come back to the Robot
- *** page on the Arduino server for updates!!
- ***
- *******************
-
- If you connect a IR receiver to the robot,
- you can control it like you control a TV set.
- Using a Sony compatiable remote control,
- map some buttons to different actions.
- You can make the robot move around without
- even touching it!
-
- Circuit:
- * Arduino Robot
- * Connect the IRreceiver to TDK2
- * Sony compatible remote control
-
- based on the IRremote library
- by Ken Shirriff
- http://arcfn.com
-
- created 1 May 2013
- by X. Yang
- modified 12 May 2013
- by D. Cuartielles
-
- This example is in the public domain
- */
-
-// include the necessary libraries
-#include <IRremote.h>
-#include <ArduinoRobot.h>
-
-// Define a few commands from your remote control
-#define IR_CODE_FORWARD 0x2C9B
-#define IR_CODE_BACKWARDS 0x6C9B
-#define IR_CODE_TURN_LEFT 0xD4B8F
-#define IR_CODE_TURN_RIGHT 0x34B8F
-
-int RECV_PIN = TKD2; // the pin the IR receiver is connected to
-IRrecv irrecv(RECV_PIN); // an instance of the IR receiver object
-decode_results results; // container for received IR codes
-
-void setup() {
- // initialize the Robot, SD card, display, and speaker
- Robot.begin();
- Robot.beginTFT();
- Robot.beginSD();
-
- // print some text to the screen
- Robot.stroke(0, 0, 0);
- Robot.text("Remote Control code:", 5, 5);
- Robot.text("Command:", 5, 26);
- irrecv.enableIRIn(); // Start the receiver
-}
-
-void loop() {
- // if there is an IR command, process it
- if (irrecv.decode(&results)) {
- processResult();
- irrecv.resume(); // resume receiver
- }
-}
-
-void processResult() {
- unsigned long res = results.value;
- // print the value to the screen
- Robot.debugPrint(res, 5, 15);
-
- if(res == IR_CODE_FORWARD || res == IR_CODE_BACKWARDS || res == IR_CODE_TURN_LEFT || res == IR_CODE_TURN_RIGHT) {
- Robot.fill(255, 255, 255);
- Robot.stroke(255, 255, 255);
-
- Robot.rect(5, 36, 55, 10);
- }
- switch(results.value){
- case IR_CODE_FORWARD:
- Robot.stroke(0, 0, 0);
- Robot.text("Forward", 5, 36);
- Robot.motorsWrite(255, 255);
- delay(300);
- Robot.motorsStop();
- break;
- case IR_CODE_BACKWARDS:
- Robot.stroke(0, 0, 0);
- Robot.text("Backwards", 5, 36);
- Robot.motorsWrite(-255, -255);
- delay(300);
- Robot.motorsStop();
- break;
- case IR_CODE_TURN_LEFT:
- Robot.stroke(0, 0, 0);
- Robot.text("Left", 5, 36);
- Robot.motorsWrite(-255, 255);
- delay(100);
- Robot.motorsStop();
- break;
- case IR_CODE_TURN_RIGHT:
- Robot.stroke(0, 0, 0);
- Robot.text("Right", 5, 36);
- Robot.motorsWrite(255, -255);
- delay(100);
- Robot.motorsStop();
- break;
- }
-}
-