Desription
Through one potentiomenter and FSRs, I control the brightness and blinking of 2LEDs. I also find material, a soft plastic model, to control perssure for ESRs effectively. On processing, I tried to control digital ball's reflection.
Components
1LED, a ping-pong ball as a diffuser, a red soft plastic heart, FSRs, 1 petentiometer, 9wires, Arbuino Board, Bread Board
Arduino Codes
int pot1Pin = 0; // select the input pin for the FSRs, Brightness
int pot2Pin = 1; // select the input pin for the potentiometer1, Blinking
int pot1Val = 0; // variable to store the value coming from pot 1
int pot2Val = 0; // variable to store the value coming from pot 2
int redPin = 9; // the pin for the red LED
int greenPin = 10; // the pin for the green LED
void setup() {
pinMode(redPin, OUTPUT); // declare the led1Pin as an OUTPUT
pinMode(greenPin, OUTPUT); // declare the led2Pin as an OUTPUT
}
void loop() {
pot1Val = analogRead(pot1Pin); // read the value from pot 1, between 0 - 1024, for dimming
pot2Val = analogRead(pot2Pin); // read the value from pot 2, between 0 - 1024, for blinking
analogWrite(redPin, pot1Val/4); // dim LED to value from pot1
analogWrite(greenPin, pot1Val/4);
delay(pot2Val); // stop the program for some time, meaning, LED is on for this time
analogWrite(redPin, 0); // dim LED to completely dark (zero)
analogWrite(greenPin, 0);
delay(pot2Val); // stop the program for some time, meaning, LED is OFF for this time
}
Processing
void setup() {
size(200, 200, P3D);
noStroke();
colorMode(RGB, 1);
fill(0.4);
}
void draw() {
background(0);
translate(width / 2, height / 2);
// Set the specular color of lights that follow
lightSpecular(1, 1, 1);
directionalLight(0.8, 0.8, 0.8, 0, 0, -1);
float s = mouseX / float(width);
specular(s, s, s);
sphere(50);
}