Skip to main content

Scratch AI
Scratch AI

Child friendly block programming based on scratch, create your own games play with Otto robot and start to interact with Artificial Intelligence!

42 followers
1 question
12 posts

3D printing, robotics and programming

I had some time to mess around with the New blockly, It is still showing up as a white screen from time to time. But when I did manage to keep it open I made this small program for the Otto remix I call October.

Now before the new blockly, after the robot did a small walk with the loop, instead of staying in the position of the last leg up or down when the walk timed out, I could use a "Home" block to make it reset to a neutral position. Can you take a look at the code and see if I need to add something to it. It can be as simple as not knowing how to setup the blocks, because they are new.
Thanks.

#include <Otto9.h>
Otto9 Otto;
#include <Servo.h>

#define PIN_YL 2 // left leg, servo[0]
#define PIN_YR 3 // right leg, servo[1]
#define PIN_RL 4 // left foot, servo[2]
#define PIN_RR 5 // right foot, servo[3]
#define PIN_Trigger 8 // ultrasonic sensor trigger
#define PIN_Echo 9 // ultrasonic sensor echo
#define PIN_Buzzer 13 //buzzer

Servo servo_6;
Servo servo_7;

void Setup_Configuration() {
servo_6.write(95); delay(0);
servo_7.write(100); delay(0);
Otto.home();
}

void Hands_Down() {
servo_6.write(10); delay(0);
servo_7.write(180); delay(0);
}

void Hands_Up() {
// L
servo_6.write(180); delay(0);
// R
servo_7.write(28); delay(0);
}


void setup() {
Otto.init(PIN_YL, PIN_YR, PIN_RL, PIN_RR, true, A6, PIN_Buzzer, PIN_Trigger, PIN_Echo);
Setup_Configuration();

Otto.setTrims(10,0,0,0);
servo_6.attach(6);
servo_7.attach(7);
}

void loop() {
Hands_Down();
delay(4*1000);
Hands_Up();
delay(4*1000);
Hands_Down();
delay(1*1000);
for (int count=0 ; count<2 ; count++) {
Otto.walk(1,1000,1); // FORWARD
}
delay(1*1000);

}

New BLE code to interact with Otto from Scratch AI using Bluetooth

Do you know that you can instantly program and control Otto via Bluetooth from Otto Scratch AI?

  1. Download the latest libraries of Otto here
  2. Delete the old ones to Install the new libraries in Arduino.
  3. Upload this code to your Otto
  4. Install Scratch link plugin  and activate (it should appear in your task bar)
  5. Turn on your computer Bluetooth
  6. Open Otto Scratch AI
  7. Click extensions on the bottom left icon and select Otto Plus
  8. Find your device and connect, by clicking in any Otto block you will see Otto moving 

We will be sharing some examples of how to use Artificial Intelligence here with Tensor Flow extensions and Machine Learning

Make sure you have the Bluetooth module connected to your Otto robot accordingly Bluetooth   Pin TX  goes to pin 11 and RX to pin 12

Let us know how it goes!