Description
A wheel painted with a spiral pattern to use for hypnotizing. LEDs fire randomly behind it for added madness.
Components
DC motor
Transistor
Diode
Resistors
Wheel
4x white LEDs
Arduino Code
/*
* one pot fades one motor
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave
* Modified again by Laura
*/
int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 4;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
digitalWrite(led1, HIGH);
delay(random(10,100));
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(random(10,100));
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
delay(random(10,100));
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(random(10,100));
digitalWrite(led4, LOW);
}