Week 10 – Everything, Everywhere, All at Once

Concept

I wanted to explore how different components can interact with each other in a circuit. It is not simply how the buttons can control the lights or the variable resistors can transmit ranges of analog values. I want to understand if I can make an indirect interaction between the lights and the resistors such that I can light up another light using a light.

IMPLEMENTATION

Using a button, I manipulate 1 light to light up as we push down on the button. For the analog input, I used the photocell to manipulate another light to light up when I am not covering it. However, another special thing is that the button can also control the second light when the photocell is covered.

Below is an estimation of the material that I used:

 

Below is the schematic for circuit:

Code implementation:

int led1 = 13;
int led2 = 12;
int brightness = 0;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  pinMode(A3, INPUT);
  pinMode(led2, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A2);
  int buttonState = digitalRead(A3);

  sensorValue = constrain(sensorValue, 500, 900);
  brightness = map(sensorValue, 500, 860, 255, 0);

  analogWrite(led1, brightness);
  analogWrite(led2, brightness);

  Serial.println(sensorValue);
  delay(30);  // delay in between reads for stability


  if (buttonState == LOW){
    digitalWrite(led2, LOW);
  }
  else{
    digitalWrite(led2, HIGH);
  }
}

Video in Action

I realized that everything in my circuit is connected to each other even though there is no link between them. Take the inspiration of the movie “Everything, Everywhere, All at Once”, the ultimate result can only happen if all of the previous actions are done:

Challenges

It is quite difficult to grasp the concept of using different small circuits to serve for the bigger general circuit. I have a bit of trouble to utilize the brightness of another LED to adjust the value for the photocell. However, it works out in the end as I try to figure out the correct range of the new values of the photocell with the LED.

Reflection

Even though I was able to make a schematic diagram for the circuit, it is quite unorganized right now, I would like to learn more about how I can organize the wires and components so that it can be seen clearly in the diagram.

Leave a Reply