Becky Button
Published © GPL3+

Catbot

With an Adafruit Circuit Playground Express and some posterboard, you can create a cat bot (or a dog bot).

BeginnerFull instructions provided2 hours713

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Servos (Tower Pro MG996R)
×1
Adafruit LED Sequins
×1
Alligator Clips
Alligator Clips
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring

look at the code for a better understanding of how to wire it

Code

CPX_Robot

Arduino
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>

#include <Servo.h>

Servo servo;

//change to whatever DIO you are using
// D9 = A2 on CPX
int lightPin1 = 9;

//change to whatever DIO you are using
// D10 = A3 on CPX
int lightPin2 = 10;

//change angle as needed
int minAngle = 110;
int maxAngle = 160;

// delay rate variable
int rate;

void setup() {
  CircuitPlayground.begin();
  //puts servo on DIO 2, which is A5 on the CPX
  servo.attach(2);
  pinMode(lightPin1, OUTPUT);
  pinMode(lightPin2, OUTPUT);
}

void loop() {

  if (CircuitPlayground.slideSwitch() == true)
  {
    //go into demo mode
    servo.write(minAngle);
    digitalWrite(lightPin1, HIGH);
    digitalWrite(lightPin2, HIGH);
    delay(500);
    servo.write(maxAngle);
    digitalWrite(lightPin1, LOW);
    digitalWrite(lightPin2, LOW);
    delay(500);
  }
  else
  {
    //go into sensor mode
    //change the sensor if need be
    rate = map(CircuitPlayground.soundSensor(), 0, 1023, 0, 2500);
    servo.write(minAngle);
    digitalWrite(lightPin1, HIGH);
    digitalWrite(lightPin2, HIGH);
    delay(rate);
    servo.write(maxAngle);
    digitalWrite(lightPin1, LOW);
    digitalWrite(lightPin2, LOW);
    delay(rate);
  }
}

Credits

Becky Button

Becky Button

3 projects • 28 followers
maker - hardware is my friend
Thanks to Ruiz Brothers.

Comments