Week 8 – part 2

Goal of the project : create a robotic ouija board
Core components : servo motor, arduino, a button and a resistor
How it works : when the button is pressed the robotic hand moves randomly to a 0-360 degree pointing to one letter at the time

Arduino code:

#include <Servo.h>;

const int buttonPin = 8;
const int servoPin = 9;
Servo servo;

void setup()
{
servo.attach (servoPin);
pinMode(buttonPin, INPUT);
}

void loop()
{
int buttonState;
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
servo.write (random(0-360));
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *