First encounter with the Flora

This class works really well in parallel with Physical Computing. While we delve more into the basics of electronics in P Comp, we jumped right into implementing simple interactions with the Flora in the second part of the Costumes class. We used pre-existing code that Kaho provided to light up a LED on the Flora with the press of a button.

Lighting up LED with one switch.

Lighting up LED with one switch.

Lighting up LED with two buttons.

Lighting up LED with two buttons.

It was fairly easy to make adjustments to the code and configurations of the connections to try various ways of lighting up the LED and even to input text with a button.

jia

Printing strings by pressing on a switch.

Printing strings with DIY switch.

Printing strings with DIY switch.

We also tried using conductive fabric and material as a switch. One of the takeaway from this was that, because contact from fabric is not as secure as a conventional switch, we need to “debounce” in the code to make the response more stable. Debouncing checks the lastButtonState and ensure that it’s different from the current buttonState. Again, we used pre-existing code to do this. I’ll need to look more into this to have a better understanding. There was a lot of tickering around with the code and connections until things worked. I’m making baby steps to building my own mind altering costume.

 

MineSweeper

Screen Shot 2014-09-10 at 8.07.09 AMThis is my first assignment for ICM.

I first started playing around with shapes in for loops. These are a few of the patterns that I created.

 

exercises

The red triangles reminded me of the flags in the game Minesweeper, so I turned them into flags, like this.

flagflagflagflagflagflagflagflagflagflagflagflagflag

Then added abstracted explosions with yellow triangles and lines.

***** code *****

void setup() {
size (700, 600);
background(255);
}

void draw() {
fill(255, 0, 0, 150);
//noStroke();
smooth();

for (int y = 30; y < height-30; y += 15) {
for (int x = 35; x < width-35; x += 13) {

/*fill(0-y);
noStroke();
triangle(x+11, y, x+6.5, y+8, x+15.5, y+8);
//fill(255, y-150, x-y, 150);*/

// flags
fill(255, 0, 0);
noStroke();
triangle(x-1, y, x+8, y-4, x+8, y+4);

stroke(0);
strokeWeight(1);
line(x+7, y+4, x+7, y+6);
line(x+2, y+7, x+7, y+7);
strokeWeight(2);
line(x+1, y+9, x+9, y+9);

stroke(y+50, y+50, y+50);
line(x-1, y, 300, 240);
}
}

//stroke(80);
rect(278, 238, 44, 44);
fill(150);

//bomb
fill(0);
noStroke();
ellipse(300, 260, 20, 20);

fill(255);
noStroke();
ellipse(296, 256, 5, 5);

//top
stroke(0);
strokeWeight(2);
line(300, 249, 300, 245);

//bottom
line(300, 271, 300, 275);

//left
line(289, 260, 285, 260);

//right
line(311, 260, 315, 260);

strokeWeight(2);
//top left
line(289, 248, 293, 252);

//top right
line(311, 248, 308, 251);

//bottom left
line(288, 272, 291, 269);

//bottom right
line(311, 272, 308, 269);

}

 

 

Making up lost times with my breadboard

Last week I didn’t do the breadboard and multimeter labs because of poor time management. Though we went through most of them in class and I was able to make my LEDs light up with the help of Benedetta and Sweta (thanks!), I figured that I should try them again on my own so that I get the fundamentals and reduce the chance that I’ll set anything on fire in the future.

Below are some of the results:

IMG_29201 LED with voltage regulator + 9V battery: Yay! It’s alive.

IMG_2921

 

2 LEDs connected in series

IMG_2922

3 LEDs in connected in series: Boo. I forgot that the voltage regulator converts voltage from 9V (batter) to 5V. Each LED uses about 2V, so 3 of them would need more than 5V. I wonder what would happen if I remove the voltage regulator, and let the 9V go directly to the series of 3 LEDs?

IMG_2917

3 LEDs hanging out in parallel: This time it works, because the voltage is not split up between each of the LED. Each LED uses the same amount of voltage in this case.

IMG_2923

3 LEDs in parallel: This time the red LEDs are much brighter than the green one. The red LEDs uses less voltage than the green one, so is this prompting the current to pass through the red ones and not the green one? Would this potentially damage the green LED?

IMG_2925

1 LED with Arduino built in 5V

IMG_2927

1 LED with switch OFF: This is strange. Why is the switch measured at 3.8V when it’s turned off???

IMG_29291 LED with switch ON: And now the switch is at 0V. Why? Is it because the switch acts like a piece of continuous wire when it’s turned on?

IMG_2936

2 LEDs in series with switch OFF: I tried this again with 2 LEDs and measuring at the end of the wires. Again, the switch measured at around 3V when turned off.

IMG_29382 LEDs in series with switch ON: Again the switch measure at very little V, 4.8mV which is 0.0048V, when it’s switched on.