10 February 2026

The LED game

 

This is meant to be a game where you use the potentiometer along with an analog joystick to control the values of an LED. You try to match these values to the first LED, which is randomly assigned at the start of the game. When you finish and get close enough to the color, the LEDs flash and restart, allowing the first LED to change color. If you get it wrong, a buzzer will sound, letting you know you haven't gotten it yet. 
The analog inputs include two from the Joystick: vrX and VrY. The Joystick also uses the press-down digital input represented by the white wire. This allows the user to check whether they are close to the LED color. The jumper cable wires represent what color they are: red, green, or blue. For the Joystick, the red value is the power, while black is the ground, and white is the button input. For the potentiometer, the jumper wires are primarily red to both show power and the input for the red LED. The only exception to this is an orange wire used with the buzzer. 
Finally, there are paper UI showing the red knob, the Green and blue, and a label that says press to check on the joystick. 








int ledUpRed = 6; 
int ledUpGreen = 5; 
int ledUpBlue = 3; 
int ledDownRed = 11; 
int ledDownGreen = 10; 
int ledDownBlue = 9 ; 
int buzzer = 7; 

int vrXGreen = A1; 
int vrYBlue = A2; 
int knobRed = A0; 

int confirmButton = 2; 

int randomRed; 
int randomGreen; 
int randomBlue; 

int mapValRed; 
int mapValGreen; 
int mapValBlue; 

int close = 5; 
 

void setup() {
  pinMode(ledUpRed, OUTPUT);
  pinMode(ledUpGreen, OUTPUT);
  pinMode(ledUpBlue, OUTPUT);
  pinMode(ledDownRed, OUTPUT);
  pinMode(ledDownGreen, OUTPUT);
  pinMode(ledDownBlue, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode (vrXGreen, INPUT);
  pinMode (vrYBlue, INPUT);
  pinMode (knobRed, INPUT);
  pinMode(confirmButton, INPUT_PULLUP);

  //set up the first random number for the upper one
  Random(); 

  // put your setup code here, to run once:
    Serial.begin(9600);

 
}
void Random(){//also going to be the reset function for the end of the 'game' 
  //get random numbers 
  randomRed = random(0, 255);
  randomGreen = random (0, 255);
  randomBlue = random ( 0, 255);

  //set these values to the upper pin .. probably in loop. 


}

void AssignRandom(){
  analogWrite(ledUpRed, randomRed);
  analogWrite(ledUpGreen, randomGreen);
  analogWrite(ledUpBlue, randomBlue);
  delay(10); //this is to make sure its not too quick
}
void loop() {
   digitalWrite(buzzer, LOW);
  
  AssignRandom(); 
  // scale the values of the inputs map and set them 
  MapValues(); 
    
  //check the values to see if they are close to one another when pressing confirm 
  if(!digitalRead(confirmButton)){ 
      if(CheckValues()){ //check values is kinda wrong 
        // do the lalalalala
        // make both the LEDs fade to white then off then slowly restart the 'game' 
        CoolEnd(); 


      } 
      else{ 
        //fail sound play buzzer
        digitalWrite(buzzer, HIGH);
        

        Serial.println("you failed!");
      }


  }

}
void CoolEnd(){
  analogWrite(ledUpRed, 255);
  analogWrite(ledUpGreen, 255);
  analogWrite(ledUpBlue, 255);
  analogWrite(ledDownRed, 255);
  analogWrite(ledDownGreen, 255);
  analogWrite(ledDownBlue, 255);

  delay(200);
  analogWrite(ledUpRed, 0);
  analogWrite(ledUpGreen, 0);
  analogWrite(ledUpBlue, 0);
  analogWrite(ledDownRed, 0);
  analogWrite(ledDownGreen, 0);
  analogWrite(ledDownBlue, 0);
    delay(200);

  Random(); 

  

}
bool CheckValues(){
  // check the values.. if they are 30 ish close enough return true, if not return false 
  bool redCorrect = false; 
  bool blueCorrect = false; 
  bool greenCorrect = false; 
  if((analogRead(ledDownRed) - analogRead(ledUpRed))< close &&  (analogRead(ledDownRed) - analogRead(ledUpRed)) >-close )
  redCorrect = true; 
  if((analogRead(ledDownGreen) - analogRead(ledUpGreen))< close &&  (analogRead(ledDownGreen) - analogRead(ledUpGreen)) >-close )
  greenCorrect = true; 
  if((analogRead(ledDownBlue) - analogRead(ledUpBlue))< close &&  (analogRead(ledDownBlue) - analogRead(ledUpBlue)) >-close )
  blueCorrect = true; 

Serial.println("these are the true or false");
Serial.println(blueCorrect);
Serial.println(redCorrect);
  if(redCorrect && blueCorrect && greenCorrect){
    return true; 
  }
  else{
    return false; 
  }

}
void MapValues(){

  
  int mapValRed = map(analogRead(knobRed),0, 1023, 0, 255);
  int mapValBlue = map(analogRead(vrYBlue), 0, 1023, 0, 255);
  int mapValGreen = map(analogRead(vrXGreen), 0, 1023, 0, 255); 


 

  //then write 
  analogWrite(ledDownRed, mapValRed);
  analogWrite(ledDownGreen, mapValGreen);
  analogWrite(ledDownBlue, mapValBlue);
 

  //delay for nonsense 
  delay(10);


}







Marie's Mapping

 


Mapping

This project demonstrates an RGB LED controlled through a switch-based input system, where user interaction directly affects the color output of the light. The strength of which is determined by how far the user slides the potentiometer on the breadboard. The potentiometer functions as the primary and only way to provide user input. It sends signals that allows the light of the LED to appear blue when activated and increase it's brightness overall. The RGB LED switch emphasizes the relationship between hardware inputs, some minor software logic and visual output. Internally, the microcontroller reads the switch’s state and maps it to strength of the blue color in the LED. demonstrating basic input mapping and conditional logic. Displaying how user interaction can dynamically shape an electronic system’s behavior. This project serves as a practical example of physical computing design at a small scale.

Sketch

Schematic


Pictures

Video Demonstration 

Code

const int bluePin = 9;
const int greenPin = 10;
const int redPin = 11;
const int thePin = A1;

int maxVal = 0;
int minVal = 1023;

void setup() {
  // put your setup code here, to run once:
  pinMode (bluePin, OUTPUT);
  pinMode (greenPin, OUTPUT);
  pinMode (redPin, OUTPUT);
  pinMode (thePin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(analogRead(thePin));
  int knobval = analogRead(thePin);
  if (knobval > maxVal) maxVal = knobval;
  if (knobval < minVal) minVal = knobval;
  int mapval = map(knobval, minVal, maxVal, 0, 255);
  analogWrite(redPin, mapval);
  delay(10);
  Serial.print(knobval);
  Serial.print("\t");
  Serial.print(minVal);
  Serial.print("\t");
  Serial.println(maxVal);

  //for(int i=0; i<255 analogwrite="" bluepin="" code="" delay="" greenpin="" i="" redpin="">

08 February 2026

Unconventional Switch - Electronic Group 11

 



For our unconventional switch, we decided to make a can that when a lid closes it, an LED would light. We used a 3.3v power source, a 2v LED, and a 100-ohm resistor. One clip is connected to the lid, and the other clip is connected to the bottom of the can. The LED lights when the lid is on, signifying whatever is in the can can't be taken out, until the light turns off. The light kind of signifies the spark in a kid's brain whenever they see a closed wafer/cookie jar, and the light stays on until they figure out how to get the lid off.











Unconventional switch - Team 4

 Unconventional switch - Team 4 



 
    For our unconventional switch, we chose to use Gatorade as the method for turning the circuit on and off. Using a power supply, two 100ohm resistors, A red LED, and two alligator clips, we connected the components together and placed both clips at the top of a cup without letting them touch

    Gatorade contains a high amount of salt, which lets the current pass through it and complete the circuit. When the liquid reaches the clips, the circuit is completed and the LED turns on. 

    The practical use for this setup is as an indicator to show when to stop pouring your drink. Like if it was dark at night the led would let you know. This could also be improved, if we used a speaker it would make an even better indicator for the visually impaired. Alternatively you could reverse this, with the led on when the cup is full. You can check if anyone stole some of your drink because the led would turn off if the liquid went lower


Unconventional Switch - Team 3

 

For our Unconventional Switch, we chose to use a glass of lemonade as the switch. 

Lemon juice, and by proxy: lemonade, is a conductive fluid. This is due to the high amounts of citric acid it contains, which makes the water act as an electrolyte. In fact, one could use a lemon to make a whole battery and produce electricity. 
However, we were sufficient in just using it to simply transfer power from our own power source. The electricity comes in and out of the juice through alligator clips which connect it to the rest of the circuit. But to keep the clips dry from the corrosive juice, we used tinfoil to dip into the juice and carry the charge into it. The tinfoil is at different levels within the cup. Which means if enough juice is removed, usually by drinking out of the straw, then the circuit would be open and the LED wouldn’t be powered anymore. Adding juice back into the cup will close the circuit and restore power to the LED. A specifically plastic straw is used to remove juice from the cup, as you wouldn’t want to use a metal straw for charged lemonade. Since we used another straw to hold one of the tinfoil clumps, we call it Lemonade for Two!

Unconventional Switch Team- 19



We chose to do two swords hooked up that once they touch each other turns on the LED. The blades are metal and so is the desk as shown in the video, but only the swords clashing turns on the led no other surface. 

It's a 5v power supply with a 100 ohm resistor with a red 3v LED light. We got one alligator on the breadboard and another next to the LED, these then lead to the clamps that are then firmly attached to the tip of each sword. Once they touch, the electricity conducts to the LED. The moment they stop touching it stops. 

As one can see we went for the aesthetic route. Who wouldn't want to see cool sword light effects? This can be used for entertainment such as a light show or a movie. This is because it can pick up and flash exactly when a blade clashes. And since it doesn't need that hard of a press, just a simple touch, its easy for performers to "fake" clashes. 




Unconventional Switch: Electronics Team 10

 For our take on the unconventional switch assignment, we decided to include a practical design aspect, which involves hanging keys up on a lanyard. The reason we chose this line of reasoning is because it reflects something common and mundane that most people wouldn't typically think twice about. In many ways, taking a key off or placing it on a lanyard is often a means to an end, serving as a step towards another goal, so we decided to intentionally showcase this often-overlooked step.

We utilized the conductivity of the key ring and the conductive portion of the lanyard (the metal ring). By attaching an alligator clip to each of these components, the green LED would turn on once the key ring was clipping onto the lanyard, closing the circuit by touching one another. Then, once the key is unclipped, the circuit is opened and the LED turns off. 


Switch Circuit Schematic:



Video Demonstration: