Tumgik
shenchengfu · 2 years
Text
Tumblr media
For Project 1, I want to improve what I did for the Digital Ins and Outs assignment to make it more interactive. So I decided to add a knob and a photoresistor to control the time between switch the Leds.
In a room with sufficient lighting, the delay time between the switch of Leds will depend on the knob. However, if you block the lights for the photoresistor, the Leds will start to flash like an alarm which tells you that you need more light!
Here is my code:
// constants won't change. They're used here to set pin numbers: const int buttonPinOne = 2; // the number of the pushbutton pin const int buttonPinTwo = 20; // the number of the pushbutton pin const int ledPinOne = 5; // the number of the LED pin const int ledPinTwo = 18; // the number of the LED pin
// variables will change: int buttonStateOne = 0; // variable for reading the pushbutton status int buttonStateTwo = 0; // variable for reading the pushbutton status int delayTime = 0; int anVal = 0; int anInputPin = A1;
void setup() { // initialize the LED pin as an output: pinMode(ledPinOne, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPinOne, INPUT); // initialize the LED pin as an output: pinMode(ledPinTwo, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPinTwo, INPUT);
Serial.begin(9600); }
void loop() { int knobValue = analogRead(A0); anVal = analogRead(anInputPin);
buttonStateOne = digitalRead(buttonPinOne); buttonStateTwo = digitalRead(buttonPinTwo); if(anVal > 600){ delayTime = 100; } else{ delayTime = knobValue + 200; }
if (buttonStateOne == HIGH && buttonStateTwo == LOW) { digitalWrite(ledPinOne, HIGH); digitalWrite(ledPinTwo, LOW);} else if (buttonStateTwo == HIGH && buttonStateOne == LOW) { digitalWrite(ledPinTwo, HIGH); digitalWrite(ledPinOne, LOW);} else if(buttonStateOne == HIGH && buttonStateTwo == HIGH){ digitalWrite(ledPinTwo, HIGH); digitalWrite(ledPinOne, LOW); delay(delayTime); digitalWrite(ledPinTwo, LOW); digitalWrite(ledPinOne, HIGH); delay(delayTime);} else{ digitalWrite(ledPinOne, LOW); digitalWrite(ledPinTwo, LOW); } }
0 notes
shenchengfu · 2 years
Text
For this week's assignment, I want to do a little bit more then just turn on and off the lights. So I tried to make something interesting happen when both switchs are on.
I noticed that the lights are red and yellow, which makes me think about the alarm, so I decided to make it looks like an alarm by make both lights blink. Here is my code:
// constants won't change. They're used here to set pin numbers: const int buttonPinOne = 2; // the number of the pushbutton pin const int buttonPinTwo = 20; // the number of the pushbutton pin const int ledPinOne = 5; // the number of the LED pin const int ledPinTwo = 18; // the number of the LED pin
// variables will change: int buttonStateOne = 0; // variable for reading the pushbutton status int buttonStateTwo = 0; // variable for reading the pushbutton status
void setup() { // initialize the LED pin as an output: pinMode(ledPinOne, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPinOne, INPUT); // initialize the LED pin as an output: pinMode(ledPinTwo, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPinTwo, INPUT); }
void loop() { // read the state of the pushbutton value: buttonStateOne = digitalRead(buttonPinOne); buttonStateTwo = digitalRead(buttonPinTwo);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonStateOne == HIGH && buttonStateTwo == LOW) { // turn LED on: digitalWrite(ledPinOne, HIGH); digitalWrite(ledPinTwo, LOW);} else if (buttonStateTwo == HIGH && buttonStateOne == LOW) { // turn LED on: digitalWrite(ledPinTwo, HIGH); digitalWrite(ledPinOne, LOW);} else if(buttonStateOne == HIGH && buttonStateTwo == HIGH){ digitalWrite(ledPinTwo, HIGH); digitalWrite(ledPinOne, LOW); delay(500); digitalWrite(ledPinTwo, LOW); digitalWrite(ledPinOne, HIGH); delay(500);} else{ digitalWrite(ledPinOne, LOW); digitalWrite(ledPinTwo, LOW); } }
0 notes
shenchengfu · 2 years
Text
EFFEKTORIUM – interactive virtual orchestra
youtube
        EFFEKTORIUM is a virtual orchestra made by WHITEvoid Studio for the Mendelssohn-Bartholdy Museum Leipzig. There is a dias for the user with a camera on it. The user can swing the baton in front of the camera to begin the concert and control the tempo. The camera may capture the speed of the baton swing from one side to another side and reflect that data by changing the  tempo of the instruments which are conducted by the user.
        The project is exhibited in Bertron Schwarz Frey in German. People who are interested in classical music and symphony will be attracted by this idea since it is a combination of classical music and mordern technology
        EFFEKTORIUM provide an epic experience of conducting a whole orchestra. And it also allow the user to mute a specific group of instruments or make one instrument solo which are useful to the actual conductor to get familiar with each part of the symphony. There is an electronic note-pad that the user can chooses which pieces the user want to conduct which can give the users different experiences.
Tumblr media
reference: https://www.whitevoid.com/effektorium/
1 note · View note