PhysComp 3

Ran the analogue sample example from arduino, link.

Here is the result.

Then I finally worked out the kinks for running the vibe motors on the puppet costume for this project.

So that when the user goes from left to right, their pulsating decreases towards the middle. So the more left the user turns the knob, the stronger the leftmost vibe motors will pulsate, as the knob is moved towards the middle the leftmost vibe motors pulsate less, until they grind to a halt and the right most ones start grinding to a start, the more to the right the knob is turned the more the rightmost ones will pulsate. Yay! Since vibe motors and led’s are both digital out that depend only on the presence of current for their pulsating, I used leds for the test. Link to video.

What I don’t understand is why I had to have the led’s pulse HIGH to keep them from turning on?


int sensorPin = 0; // select the input pin for the potentiometer
int pinOut1 = 2;
int pinOut2 = 3; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor

void setup() {
// declare the ledPin as an OUTPUT:
pinMode(pinOut1, OUTPUT);
pinMode(pinOut2, OUTPUT);

Serial.begin(9600);
}

void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
// turn the ledPin on
if(sensorValue < 512){ digitalWrite(pinOut1, HIGH); digitalWrite(pinOut2, HIGH); delay((sensorValue)*2); digitalWrite(pinOut1, LOW); digitalWrite(pinOut2, HIGH); } if(sensorValue > 512){

digitalWrite(pinOut1, HIGH);
digitalWrite(pinOut2, HIGH);
delay(abs((sensorValue-1023)*2));
digitalWrite(pinOut1, HIGH);
digitalWrite(pinOut2, LOW);
}
}