All Posts

Imperfect light entertainment

SEE THE UPDATES BELOW

In order to upgrade the drum that I made last time, I tried to make the light part of the entertainment more appealing, using the knowledge gained from the last class. From the video, you could see there are 5 lamps implemented and light one by one. Imagine the buttons are the sticks. It is supposed to look like a streak of light, like a thunder. (It just doesn’t look like it is, but with better equipments, it can look better). When two switches are closed at the same time, all the lights light up at the same time.

 

Continue reading “Imperfect light entertainment”

Turn ALL the lights on

I’ve created a mini game. The challenge here is to figure out which 2 of the 4 switches you have to press to turn all 4 lights one. It’s a simple guessing game, with not a lot of possibilities, but things could get a little more interesting by increasing the number of switches and introducing logical hints to the players.

The correct two switches are coded in, and here is the source code to the program being used for this game (if arrays were introduced here, it would have made the code more efficient and short):

void setup() {
  //green light
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
  //red light
  pinMode(4, INPUT);
  pinMode(5, OUTPUT);
  //blue light
  pinMode(6, INPUT);
  pinMode(7, OUTPUT);
  //yellow light
  pinMode(8, INPUT);
  pinMode(9, OUTPUT);
}

void loop() {
  if(digitalRead(2) == HIGH && digitalRead(4) == HIGH){
    digitalWrite(7, HIGH);
  }

  if(digitalRead (4) == HIGH && digitalRead(6) == HIGH){
    digitalWrite(3, HIGH);
    digitalWrite(9, HIGH);
  }
  if(digitalRead (6) == HIGH && digitalRead(8) == HIGH){
    digitalWrite(3, HIGH);
  }
  if(digitalRead (2) == HIGH && digitalRead(8) == HIGH){
    digitalWrite(5, HIGH);
  }
  if (digitalRead(2) == HIGH){
    digitalWrite(3, HIGH);
  }
  if (digitalRead(4) == HIGH){
    digitalWrite(5, HIGH);
  }
  if (digitalRead(6) == HIGH){
    digitalWrite(7, HIGH);
  }
  if (digitalRead(8) == HIGH){
    digitalWrite(9, HIGH);
  }
  if (digitalRead(2) == LOW){
    digitalWrite(3, LOW);
  }
  if (digitalRead(4) == LOW){
    digitalWrite(5, LOW);
  }
  if (digitalRead(6) == LOW){
    digitalWrite(7, LOW);
  }
  if (digitalRead(8) == LOW){
    digitalWrite(9, LOW);
  }
}

And here is a diagram of how the connections are made:

logical_switch

 

If you press the two middle switches, you can turn all the lights on:

20150914_004040

 

Dining etiquette training

My mother always told me not to rest my arms on the table while eating. Although I never saw the merits of such a behavior, I did not object to her mandate and have been careful about where I placed my arms while sitting at the table ever since. Nowadays, table manners seem to have lost their significance. Yet it is never too late to learn some dining etiquette! For my Second Intro to IM assignment, I made an electrical circuit that identifies improper table manners. If only arm rests on the table, a yellow LED lights up, warning the user of her potential transgression. If, however, both arms rest on the table, both red and yellow LED’s start flashing. This is a clear signal to the user to move his arms off the table.

Continue reading “Dining etiquette training”

Light Show

Ever start listening to a bomb ass song and wish you could have some sick lights to correspond to the music? Me too!

I’ve created a board that you can press several switches and alternate the light patterns. They range from fast to slow and various other combinations. Right now there are only 4 light combinations but with enough funding there’s sure to be more!… Anyways, here’s a video of me jamming out to the song Hey Daddy by Usher #tbt amirite

Continue reading “Light Show”

Holiday Lights

For this project, I used yellow, red, and green lights that would turn on to their designated colored switches, and programmed them all to blink in a coordinated pattern with each other. Mostly, when making this project, I just kept thinking about Christmas. And while I couldn’t have snow or presents, I could at least program a tiny version of Christmas lights, while listening to carols during the project for a partial effect.

Apart from the finickiness of the switches and getting the wires to line up on the breadboard, the project was relatively easy to execute.

Initially, I tried to remember everything we learned from Wednesday’s class on programming and switches using photos I took from the class. Once I figured out how to turn on one yellow light with three switches, it became smooth sailing from there on what my errors were and how to fix them.

For this project, I used two red, two green, and two yellow lights, and the pairs were wired in parallel with each other so that they’d both turn on to the same switch input.

When you press the green button, the two green lights will light up at a specific pattern shown below in my coding. Likewise, when pressing the red button, the red lights would light up at a slightly faster speed, to light up whenever the green lights were off. And finally, when pressing the yellow button, the yellow lights will turn on when the other two lights are off. When pressing all three switches, the lights essentially light up in the sequence: green, then red, then yellow.

In order to make the lights work in parallel, the long ends are stuck in the same pin hole, and the short ends are put in the same row as 330 ohm resistors connected to ground. The switches are connected to the ground with a wire, and then a 10K ohmm resister in the row connected to the RedBoard.

When programming, I basically had three sections, with each switch connected to the designated color lights. Below is the chart I used to identify which switch went to which pin since it got confusing after a while with the wiring.

Switch in pin 3 turns on pin 7 green lights
Switch in pin 5 turns on pin 6 red lights
Switch in pin 4 turns on pin 2 yellow lights

Below is a video of how it works, and a copy of my coding:

CODING:

void setup() {
// put your setup code here, to run once:
//SWITCH Green
pinMode(3,INPUT);
// SWITCH Yellow
pinMode(4,INPUT);
// SWITCH Red
pinMode(5,INPUT);
//Red
pinMode(6,OUTPUT);
//Green
pinMode(7,OUTPUT);
//Yellow
pinMode(2,OUTPUT);

}
void loop() {
// put your main code here, to run repeatedly:

if(digitalRead(3) == HIGH){
digitalWrite(7,HIGH);
delay(250);
digitalWrite(7,LOW);
delay(750);
} else {
digitalWrite(7,LOW);

}

if(digitalRead(5) == HIGH){
digitalWrite(6, HIGH);
delay(100);
digitalWrite(6,LOW);
delay(500);
} else {
digitalWrite(6, LOW);
}

if(digitalRead(4) == HIGH){
digitalWrite(2,HIGH);
delay(50);
digitalWrite(2,LOW);
delay(250);
}else{
digitalWrite(2,LOW);
}
}

Please close the door behind you

My roommate is a very considerate person, yet he has a habit of leaving our room door open when he goes to the common room. To be frank, I don’t mind open doors in the daytime. But since I am a light sleeper and get awaken by the slightest rise in light or sound intensity, my roommate’s trips to the common area in the nighttime disrupt my sleep. This is why my first class assignment for Intro to IM features a switch that turns on the LED when the door gets open.

Continue reading “Please close the door behind you”

Status Indicator

This week, I made a combination of multiple switches and LED lights into a status indicator. The basic idea is to tell the user if they have successfully pressed a button by looking at the blinking lights. I got inspired to create this device while I was playing a game called Limbo. In Limbo, our protagonist is allowed to do three kinds of moves: forward move, backward move, and jump. Since I was playing on iPad, a touchscreen device, I had to move my fingers rightward, leftward or upward to make the moves. Sometimes, I failed to jump over a barrier because I swept across the screen so softly that the screen did not detect my finger movement. I wish there were signals telling me that I did not trigger the jump move. I thought that a physical button would be much easier to control than to sweep across the screen. Therefore, I created this device to tell the users if they have successfully pressed the button by the status of the LED lights.  Continue reading “Status Indicator”

Games!

Disclaimer: things in bold are little nuggets of knowledge that might come in useful. And notes to self, so I don’t make dumb mistakes again.

I love videogames. And colorful blinking lights, obviously. Given that I can’t make a full-blown videogame just yet, I decided to start with something simpler (but challenging given that this is just my second project). The goal: build and program a memory game (Simon).

Step 1 was making the LEDs actually turn on. Four buttons acted as inputs, and the LEDs were connected as four outputs. I could have as well made the LEDs turn on via the physical switches, but that would have defeated the purpose of the asignment. Nothing too different from what we did in class. It was simple enough to code, but it didn’t work out at the first go. My brain forgot to plug the outputs to ground (way to go – brain-five!). You can see the result here: https://youtu.be/yzMvNNp7sp4

And then the fun part started. Continue reading “Games!”