diff options
| author | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 | 
|---|---|---|
| committer | Cristian Maglie <c.maglie@bug.st> | 2013-08-08 16:43:19 +0200 | 
| commit | a8193ed933d9c9954cefbfb541cde56770ab5b74 (patch) | |
| tree | 80796833fecca5d7426f1d09f7ac9870bab5f062 /libraries/Robot_Control/examples/learn | |
| parent | a4c9fee673342304a5b12f7f2f7f9ecb9cb26d30 (diff) | |
| parent | 5527c44aa443b20d63cf7a276180a36695233924 (diff) | |
Merge branch 'ide-1.5.x-library-to-new-format' into ide-1.5.x
Diffstat (limited to 'libraries/Robot_Control/examples/learn')
16 files changed, 0 insertions, 783 deletions
diff --git a/libraries/Robot_Control/examples/learn/AllIOPorts/AllIOPorts.ino b/libraries/Robot_Control/examples/learn/AllIOPorts/AllIOPorts.ino deleted file mode 100644 index 3520214..0000000 --- a/libraries/Robot_Control/examples/learn/AllIOPorts/AllIOPorts.ino +++ /dev/null @@ -1,149 +0,0 @@ -/* - All IO Ports -  - This example goes through all the IO ports on your robot and - reads/writes from/to them. Uncomment the different lines inside  - the loop to test the different possibilities. - - The TK inputs on the Control Board are multiplexed and therefore  - it is not recommended to use them as outputs. The TKD pins on the - Control Board as well as the TK pins on the Motor Board go directly - to the microcontroller and therefore can be used both as inputs  - and outputs. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -// use arrays to store the names of the pins to be read -uint8_t arr[]  = { TK0, TK1, TK2, TK3, TK4, TK5, TK6, TK7 }; -uint8_t arr2[] = { TKD0, TKD1, TKD2, TKD3, TKD4, TKD5 }; -uint8_t arr3[] = { B_TK1, B_TK2, B_TK3, B_TK4 }; - -void setup(){ -  // initialize the robot -  Robot.begin(); - -  // open the serial port to send the information of what you are reading -  Serial.begin(9600); -} - -void loop(){ -  // read all the TK inputs at the Motor Board as analog  -  analogReadB_TKs(); - -  // read all the TK inputs at the Motor Board as digital -  //digitalReadB_TKs(); - -  // read all the TK inputs at the Control Board as analog -  //analogReadTKs(); - -  // read all the TK inputs at the Control Board as digital -  //digitalReadTKs(); - -  // read all the TKD inputs at the Control Board as analog -  //analogReadTKDs(); - -  // read all the TKD inputs at the Control Board as digital -  //digitalReadTKDs(); - -  // write all the TK outputs at the Motor Board as digital -  //digitalWriteB_TKs(); - -  // write all the TKD outputs at the Control Board as digital -  //digitalWriteTKDs(); -  delay(5);   -} - -// read all TK inputs on the Control Board as analog inputs -void analogReadTKs() { -  for(int i=0;i<8;i++) { -    Serial.print(Robot.analogRead(arr[i])); -    Serial.print(","); -  } -  Serial.println(""); -} - -// read all TK inputs on the Control Board as digital inputs -void digitalReadTKs() { -  for(int i=0;i<8;i++) { -    Serial.print(Robot.digitalRead(arr[i])); -    Serial.print(","); -  } -  Serial.println(""); -} - -// read all TKD inputs on the Control Board as analog inputs -void analogReadTKDs() { -  for(int i=0; i<6; i++) { -    Serial.print(Robot.analogRead(arr2[i])); -    Serial.print(","); -  } -  Serial.println(""); -} - -// read all TKD inputs on the Control Board as digital inputs -void digitalReadTKDs() { -  for(int i=0; i<6; i++) { -    Serial.print(Robot.digitalRead(arr2[i])); -    Serial.print(","); -  } -  Serial.println(""); -} - -// write all TKD outputs on the Control Board as digital outputs -void digitalWriteTKDs() { -  // turn all the pins on -  for(int i=0; i<6; i++) { -    Robot.digitalWrite(arr2[i], HIGH); -  } -  delay(500); - -  // turn all the pins off -  for(int i=0; i<6; i++){ -    Robot.digitalWrite(arr2[i], LOW); -  } -  delay(500); -} - -// write all TK outputs on the Motor Board as digital outputs -void digitalWriteB_TKs() { -  // turn all the pins on -  for(int i=0; i<4; i++) { -    Robot.digitalWrite(arr3[i], HIGH); -  } -  delay(500); - -  // turn all the pins off -  for(int i=0; i<4; i++) { -    Robot.digitalWrite(arr3[i], LOW); -  } -  delay(500); -} - -// read all TK inputs on the Motor Board as analog inputs -void analogReadB_TKs() { -  for(int i=0; i<4; i++) { -    Serial.print(Robot.analogRead(arr3[i])); -    Serial.print(","); -  } -  Serial.println(""); -} - -// read all TKD inputs on the Motor Board as digital inputs -void digitalReadB_TKs() { -  for(int i=0; i<4; i++) { -    Serial.print(Robot.digitalRead(arr3[i])); -    Serial.print(","); -  } -  Serial.println(""); -} diff --git a/libraries/Robot_Control/examples/learn/Beep/Beep.ino b/libraries/Robot_Control/examples/learn/Beep/Beep.ino deleted file mode 100644 index 1a78673..0000000 --- a/libraries/Robot_Control/examples/learn/Beep/Beep.ino +++ /dev/null @@ -1,39 +0,0 @@ -/* - Beep -  - Test different pre-configured beeps on - the robot's speaker. - - Possible beeps are: - - BEEP_SIMPLE - - BEEP_DOUBLE - - BEEP_LONG -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the sound speaker -  Robot.beginSpeaker(); -} -void loop() { -  Robot.beep(BEEP_SIMPLE); -  delay(1000); -  Robot.beep(BEEP_DOUBLE); -  delay(1000); -  Robot.beep(BEEP_LONG); -  delay(1000); -} diff --git a/libraries/Robot_Control/examples/learn/CleanEEPROM/CleanEEPROM.ino b/libraries/Robot_Control/examples/learn/CleanEEPROM/CleanEEPROM.ino deleted file mode 100644 index ae14bdd..0000000 --- a/libraries/Robot_Control/examples/learn/CleanEEPROM/CleanEEPROM.ino +++ /dev/null @@ -1,41 +0,0 @@ -/* - Clean EEPROM -  - This example erases the user information stored on the - external EEPROM memory chip on your robot. - - BEWARE, this will erase the following information: - - your name - - your robots name given by you - - your city and country if you configured them via software - - EEPROMs shouldn't be rewritten too often, therefore the - code runs only during setup and not inside loop. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup(){ -  // initialize the robot -  Robot.begin(); - -  // write empty strings for the different fields -  Robot.userNameWrite(""); -  Robot.robotNameWrite(""); -  Robot.cityNameWrite(""); -  Robot.countryNameWrite("");  -} - -void loop(){ -  // do nothing   -} diff --git a/libraries/Robot_Control/examples/learn/Compass/Compass.ino b/libraries/Robot_Control/examples/learn/Compass/Compass.ino deleted file mode 100644 index 4170ab7..0000000 --- a/libraries/Robot_Control/examples/learn/Compass/Compass.ino +++ /dev/null @@ -1,41 +0,0 @@ -/* - Compass -  - Try the compass both on the robot's TFT - and through the serial port. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the robot's screen -  Robot.beginTFT(); - -  // initialize the serial port -  Serial.begin(9600); -} - -void loop() { -  // read the compass -  int compass = Robot.compassRead(); - -  // print out the sensor's value -  Serial.println(compass);   -   -  // show the value on the robot's screen -  Robot.drawCompass(compass); -} - diff --git a/libraries/Robot_Control/examples/learn/IRArray/IRArray.ino b/libraries/Robot_Control/examples/learn/IRArray/IRArray.ino deleted file mode 100644 index 36b4acf..0000000 --- a/libraries/Robot_Control/examples/learn/IRArray/IRArray.ino +++ /dev/null @@ -1,44 +0,0 @@ -/* - IR array -  - Read the analog value of the IR sensors at the  - bottom of the robot. The also-called line following  - sensors are a series of pairs of IR sender/receiver - used to detect how dark it is underneath the robot. - - The information coming from the sensor array is stored - into the Robot.IRarray[] and updated using the Robot.updateIR() - method. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup(){ -  // initialize the robot -  Robot.begin(); - -  // initialize the serial port -  Serial.begin(9600); -} - -void loop(){ -  // store the sensor information into the array  -  Robot.updateIR(); - -  // iterate the array and print the data to the Serial port -  for(int i=0; i<5; i++){ -    Serial.print(Robot.IRarray[i]); -    Serial.print(" "); -  } -  Serial.println(""); -} diff --git a/libraries/Robot_Control/examples/learn/LCDDebugPrint/LCDDebugPrint.ino b/libraries/Robot_Control/examples/learn/LCDDebugPrint/LCDDebugPrint.ino deleted file mode 100644 index 0078b77..0000000 --- a/libraries/Robot_Control/examples/learn/LCDDebugPrint/LCDDebugPrint.ino +++ /dev/null @@ -1,37 +0,0 @@ -/* - LCD Debug Print -  - Use the Robot's library function debugPrint() to - quickly send a sensor reading to the robot's creen. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -int value; - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the screen -  Robot.beginTFT(); -} -void loop(){ -  // read a value -  value = analogRead(A4); - -  // send the value to the screen -  Robot.debugPrint(value); - -  delay(40); -} diff --git a/libraries/Robot_Control/examples/learn/LCDPrint/LCDPrint.ino b/libraries/Robot_Control/examples/learn/LCDPrint/LCDPrint.ino deleted file mode 100644 index d34168c..0000000 --- a/libraries/Robot_Control/examples/learn/LCDPrint/LCDPrint.ino +++ /dev/null @@ -1,44 +0,0 @@ -/* - LCD Print -  - Print the reading from a sensor to the screen. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -int value; - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the robot's screen -  Robot.beginLCD(); -} - -void loop() { -  // read a analog port -  value=Robot.analogRead(TK4); - -  // write the sensor value on the screen -  Robot.fill(0, 255, 0); -  Robot.textSize(1); -  Robot.text(value, 0, 0);   - -  delay(500); - -  // erase the previous text on the screen -  Robot.fill(255, 255, 255); -  Robot.textSize(1); -  Robot.text(value, 0, 0);   -} diff --git a/libraries/Robot_Control/examples/learn/LCDWriteText/LCDWriteText.ino b/libraries/Robot_Control/examples/learn/LCDWriteText/LCDWriteText.ino deleted file mode 100644 index e34a7d2..0000000 --- a/libraries/Robot_Control/examples/learn/LCDWriteText/LCDWriteText.ino +++ /dev/null @@ -1,41 +0,0 @@ -/* - LCD Write Text -  - Use the Robot's library function text() to - print out text to the robot's screen. Take - into account that you need to erase the - information before continuing writing. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the screen -  Robot.beginTFT(); -} -void loop() { -  Robot.stroke(0, 0, 0);              // choose the color black -  Robot.text("Hello World", 0, 0);  // print the text -  delay(2000); -  Robot.stroke(255, 255, 255);        // choose the color white -  Robot.text("Hello World", 0, 0);  // writing text in the same color as the BG erases the text! -   -  Robot.stroke(0, 0, 0);              // choose the color black -  Robot.text("I am a robot", 0, 0); // print the text -  delay(3000); -  Robot.stroke(255, 255, 255);         // choose the color black -  Robot.text("I am a robot", 0, 0);  // print the text -} diff --git a/libraries/Robot_Control/examples/learn/LineFollowWithPause/LineFollowWithPause.ino b/libraries/Robot_Control/examples/learn/LineFollowWithPause/LineFollowWithPause.ino deleted file mode 100644 index a3d3fc0..0000000 --- a/libraries/Robot_Control/examples/learn/LineFollowWithPause/LineFollowWithPause.ino +++ /dev/null @@ -1,49 +0,0 @@ -/* - Line Following with Pause -  - As the robot has two processors, one to command the motors and one to - take care of the screen and user input, it is possible to write  - programs that put one part of the robot to do something and get the - other half to control it. - - This example shows how the Control Board assigns the Motor one to - follow a line, but asks it to stop every 3 seconds. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the screen -  Robot.beginTFT(); - -  // get some time to place the robot on the ground -  delay(3000); - -  // set the robot in line following mode -  Robot.setMode(MODE_LINE_FOLLOW); -} - -void loop() { -      // tell the robot to take a break and stop -      Robot.pauseMode(true); -      Robot.debugPrint('p'); -      delay(3000); - -      // tell the robot to move on -      Robot.pauseMode(false); -      Robot.debugPrint('>'); -      delay(3000); -} diff --git a/libraries/Robot_Control/examples/learn/Melody/Melody.ino b/libraries/Robot_Control/examples/learn/Melody/Melody.ino deleted file mode 100644 index 6c049a7..0000000 --- a/libraries/Robot_Control/examples/learn/Melody/Melody.ino +++ /dev/null @@ -1,62 +0,0 @@ -/* - Melody -  - Plays a melody stored in a string.  -  - The notes and durations are encoded as follows: - - NOTES: - c  play "C" - C  play "#C" - d  play "D" - D  play "#D" - e  play "E" - f  play "F" - F  play "#F" - g  play "G" - G  play "#G" - a  play "A" - A  play "#A" - b  play "B" - -  silence - - DURATIONS: - 1  Set as full note - 2  Set as half note - 4  Set as quarter note - 8  Set as eigth note - - SPECIAL NOTATION: - .  Make the previous note 3/4 the length - - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - - This code uses the Squawk sound library designed by STG. For - more information about it check: http://github.com/stg/squawk - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the sound library -  Robot.beginSpeaker(); -} - -void loop() { -  // array containing the melody -  char aTinyMelody[] = "8eF-FFga4b.a.g.F.8beee-d2e.1-"; - -  // play the melody -  Robot.playMelody(aTinyMelody); -} diff --git a/libraries/Robot_Control/examples/learn/MotorTest/MotorTest.ino b/libraries/Robot_Control/examples/learn/MotorTest/MotorTest.ino deleted file mode 100644 index baaaf06..0000000 --- a/libraries/Robot_Control/examples/learn/MotorTest/MotorTest.ino +++ /dev/null @@ -1,41 +0,0 @@ -/* - Motor Test -  - Just see if the robot can move and turn. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); -} - -void loop() { -  Robot.motorsWrite(255,255);   // move forward -  delay(2000); -  Robot.motorsStop();           // fast stop -  delay(1000); -  Robot.motorsWrite(-255,-255); // backward -  delay(1000); -  Robot.motorsWrite(0,0);       // slow stop -  delay(1000); -  Robot.motorsWrite(-255,255);  // turn left -  delay(2000); -  Robot.motorsStop();           // fast stop -  delay(1000); -  Robot.motorsWrite(255,-255);  // turn right -  delay(2000); -  Robot.motorsStop();           // fast stop -  delay(1000); -} diff --git a/libraries/Robot_Control/examples/learn/SpeedByPotentiometer/SpeedByPotentiometer.ino b/libraries/Robot_Control/examples/learn/SpeedByPotentiometer/SpeedByPotentiometer.ino deleted file mode 100644 index e97f48d..0000000 --- a/libraries/Robot_Control/examples/learn/SpeedByPotentiometer/SpeedByPotentiometer.ino +++ /dev/null @@ -1,39 +0,0 @@ -/* - Speed by Potentiometer -  - Control the robot's speed using the on-board - potentiometer. The speed will be printed on - the TFT screen.  -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); - -  // initialize the screen -  Robot.beginTFT(); -} - -void loop() { -  // read the value of the potentiometer -  int val=map(Robot.knobRead(), 0, 1023, -255, 255); - -  // print the value to the TFT screen -  Robot.debugPrint(val); - -  // set the same speed on both of the robot's wheels -  Robot.motorsWrite(val,val); -  delay(10); -} diff --git a/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino b/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino deleted file mode 100644 index 543c06c..0000000 --- a/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino +++ /dev/null @@ -1,32 +0,0 @@ -/* - Turn Test -  - Check if the robot turns a certain amount of degrees. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); -} - -void loop(){   -  Robot.turn(50); //turn 50 degrees to the right -  Robot.motorsStop(); -  delay(1000); - -  Robot.turn(-100); //turn 100 degrees to the left -  Robot.motorsStop(); -  delay(1000); -} diff --git a/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino.orig b/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino.orig deleted file mode 100644 index 4e3624f..0000000 --- a/libraries/Robot_Control/examples/learn/TurnTest/TurnTest.ino.orig +++ /dev/null @@ -1,37 +0,0 @@ -/* - Turn Test -  - Check if the robot turns a certain amount of degrees. -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the robot -  Robot.begin(); -} - -<<<<<<< HEAD -void loop() {   -  Robot.turn(50);  //turn 50 degrees to the right -======= -void loop(){   -  Robot.turn(50);//turn 50 degrees to the right -  Robot.motorsStop(); ->>>>>>> f062f704463222e83390b4a954e211f0f7e6e66f -  delay(1000); - -  Robot.turn(-100);//turn 100 degrees to the left -  Robot.motorsStop(); -  delay(1000); -} diff --git a/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino b/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino deleted file mode 100644 index 5bbc0e5..0000000 --- a/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino +++ /dev/null @@ -1,38 +0,0 @@ -/* - Keyboard Test -  - Check how the robot's keyboard works. This example - sends the data about the key pressed through the - serial port. - - All the buttons on the Control Board are tied up to a - single analog input pin, in this way it is possible to multiplex a - whole series of buttons on one single pin. - - It is possible to recalibrate the thresholds of the buttons using - the Robot.keyboardCalibrate() function, that takes a 5 ints long - array as parameter -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -void setup() { -  // initialize the serial port -  Serial.begin(9600); -} - -void loop() { -  // print out the keyboard readings -  Serial.println(Robot.keyboardRead()); -  delay(100); -} diff --git a/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino.orig b/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino.orig deleted file mode 100644 index 6ee6c05..0000000 --- a/libraries/Robot_Control/examples/learn/keyboardTest/keyboardTest.ino.orig +++ /dev/null @@ -1,49 +0,0 @@ -/* - Keyboard Test -  - Check how the robot's keyboard works. This example - sends the data about the key pressed through the - serial port. - - All the buttons on the Control Board are tied up to a - single analog input pin, in this way it is possible to multiplex a - whole series of buttons on one single pin. - - It is possible to recalibrate the thresholds of the buttons using - the Robot.keyboardCalibrate() function, that takes a 5 ints long - array as parameter -  - Circuit: - * Arduino Robot -  - created 1 May 2013 - by X. Yang - modified 12 May 2013 - by D. Cuartielles -  - This example is in the public domain - */ - -#include <ArduinoRobot.h> - -<<<<<<< HEAD -// it is possible to use an array to calibrate -//int vals[] = { 0, 133, 305, 481, 724 }; - -void setup() { -  // initialize the serial port -  Serial.begin(9600); - -  // calibrate the keyboard -  //Robot.keyboardCalibrate(vals);//For the new robot only. -======= -void setup(){ -  Serial.begin(9600); ->>>>>>> f062f704463222e83390b4a954e211f0f7e6e66f -} - -void loop() { -  // print out the keyboard readings -  Serial.println(Robot.keyboardRead()); -  delay(100); -}  | 
