#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
//-------------------------------------
#include <Otto.h>
#include<ESP32Servo.h>
Otto Otto;
#define LeftLeg 18
#define RightLeg 5
#define LeftFoot 4
#define RightFoot 34
#define Buzzer 11
#define Trigger 12 // ultrasonic sensor trigger pin
#define Echo 13 // ultrasonic sensor echo pin
//--------------------------------------
void setup() {
Serial.begin(115200);
delay(1000);
SerialBT.begin("PA2023"); //Bluetooth device name
Otto.init(LeftLeg, RightLeg, LeftFoot, RightFoot, true, Buzzer); //Set the servo pins and Buzzer pin
Serial.println("The device started, now you can pair it with bluetooth!");
}
void loop() {
//if (SerialBT.available()) {
//if (SerialBT.read() == 'A') {
//Serial.println("Nhay");
Otto.walk(2, 1000, 1); //2 steps, "TIME". IF HIGHER THE VALUE THEN SLOWER (from 600 to 1400), 1 FORWARD
Otto.walk(2, 1000, -1); //2 steps, T, -1 BACKWARD
Otto.turn(2, 1000, 1); //3 steps turning LEFT
Otto._tone(10, 3, 1);
Otto.bendTones (100, 200, 1.04, 10, 10);
Otto.home();
delay(100);
Otto.turn(2, 1000, -1); //3 steps turning RIGHT
Otto.bend (1, 500, 1); //usually steps =1, T=2000
Otto.bend (1, 2000, -1);
Otto.shakeLeg (1, 1500, 1);
Otto.home();
delay(100);
Otto.shakeLeg (1, 2000, -1);
Otto.moonwalker(3, 1000, 25, 1); //LEFT
Otto.moonwalker(3, 1000, 25, -1); //RIGHT
Otto.crusaito(2, 1000, 20, 1);
Otto.crusaito(2, 1000, 20, -1);
delay(100);
Otto.flapping(2, 1000, 20, 1);
Otto.flapping(2, 1000, 20, -1);
delay(100);
Otto.swing(2, 1000, 20);
Otto.tiptoeSwing(2, 1000, 20);
Otto.jitter(2, 1000, 20); //(small T)
Otto.updown(2, 1500, 20); // 20 = H "HEIGHT of movement"T
Otto.ascendingTurn(2, 1000, 50);
Otto.jump(1, 500); // It doesn't really jumpl ;P
Otto.home();
//else{
//}
//}
delay(20);
}