William Sokol
Published © MIT

Lesson 4: Making Your BallyBot do tricks!

You have learned the basics of moving motors. Now learn how to do more complex movements and programming concepts!

BeginnerProtip2 hours45

Things used in this project

Hardware components

BallyBots Robot
×1
FTDI TYPE-C USB
×1
USB Cable, USB Type C Plug
USB Cable, USB Type C Plug
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Code

Arduino
void setup() {
  pinMode(14, OUTPUT); /* both wheel backward */
  pinMode(12, OUTPUT); /* right wheel forward */
  pinMode(2, OUTPUT);  /* left wheel forward */
}
void loop() {
  move(LOW,LOW,LOW, 3000);  /* stay off */
  move(HIGH,HIGH,LOW,1000); /* move forward */
  move(LOW,LOW,HIGH, 500);  /* jolt backward */
  move(HIGH,HIGH,LOW,2000); /* go forward again to land */
}
void move(bool l, bool r, bool b, int time){
  digitalWrite(2, l);   /* left motor forward */
  digitalWrite(12, r);  /* right motor forward */
  digitalWrite(14, b);  /* both motors backward */
  delay(time);        /* time till next step */
}

BallyBots Repo

Code for all the official BallyBots projects

Credits

William Sokol
10 projects • 4 followers
Robots and programming

Comments