:star: Star us on GitHub — it helps!
Based on the original Otto the robot project library : Otto DIY
:warning: This is not the original library. Programs written for the official OttoDIYLib library are not compatible.
The compatibility will be implemented in a future version.
Arduino NANO (or UNO)
Robot | Include use |
---|---|
Otto | "Otto.h" |
Otto Lee | "OttoLee.h" |
It is possible to make a custom wiring. The examples provided use the following wiring:
Servos | Pin |
---|---|
Left Leg or Wheel | 2 |
Right Leg or Wheel | 3 |
Left Foot | 4 |
Right Foot | 5 |
Left arm for Otto Lee | 6 |
Right arm for Otto Lee | 7 |
Head for Otto Lee | 10 |
Ultrasonic | Pin |
---|---|
Trigger | 8 |
Echo | 9 |
Buzzer | Pin |
---|---|
Positive | 13 |
Arduino IDE :
Platform IO :
lib_deps =
dleval/OttoArduinoLib
Add the header corresponding to the robot model at the start of the Arduino sketch.
Robot Otto :
#include <Otto.h>
Robot Otto Lee :
#include <OttoLee.h>
When creating the robot control object, all the pins must be configured.
Example :
// Pinout configuration ------------------------------------------------
#define PIN_LEG_L 2 // Left leg servo
#define PIN_LEG_R 3 // Right leg servo
#define PIN_FOOT_L 4 // Left foot servo
#define PIN_FOOT_R 5 // Right foot servo
#define PIN_ARM_L 6 // Left arm servo
#define PIN_ARM_R 7 // Right arm servo
#define PIN_HEAD 10 // Head servo
#define PIN_Trigger 8 // Ultrasound distance sensor (Trigger)
#define PIN_Echo 9 // Ultrasound distance sensor (Echo)
#define PIN_NoiseSensor A6
#define PIN_Buzzer 13 // Buzzer
// Otto driver object --------------------------------------------------
OttoLee otto(PIN_LEG_L, PIN_LEG_R, PIN_FOOT_L, PIN_FOOT_R, PIN_ARM_L, PIN_ARM_R, PIN_HEAD, PIN_NoiseSensor, PIN_Buzzer, PIN_Trigger, PIN_Echo);
When starting the program, the 'init' function must be called with the use of servomotor calibration as a parameter.
It is best to place the servomotors in their home position after initialization wwith 'home' function.
void setup() {
otto.init(true);
otto.home();
}
Many preconfigured movements are available in the library:
Example for movements of 10 jumps:
otto.jump(10,2000);
Otto can emit several sounds with the 'sing' function.
otto.sing(nameOfSound);
List of pre-recorded sounds:
It is possible to emit ons like the famous R2D2 robot with the 'r2d2' function.
otto.r2d2();
The library also includes two songs: Silent Night and Tetris.
otto.songSilentNight();
otto.songTetris();
The 'getDistance' function allows the use of the ultrasonic sensor.
float distance;
distance = otto.getDistance();
Contributing to this software is warmly welcomed. There are 3 ways you can contribute to this project:
Thanks for your contribution.
The OttoArduinoLib Library is licensed under the terms of the GPL Open Source license and is available for free.