Lab1 – LED Lights & Arduino

Description
I used Arduino with three LED lights. I have used the red, the blue and the green LED lights. I have placed the blue and red on the left side of the breadboard and placed the green on the right side of the breadboard. To achieve this, I have used two grounds and two different pins (pin 13 and pin 0). The blue and red lights will turn on for one second and turn off for .5 second, then the green LED will turn on for 2 seconds and turn off for .5 seconds. The loop will restart after green LED turns off. I have uploaded the code to ensure the timing is right. Use the black wires for grounds and the orange wires for the rest of the pins. I have also used three resistors, each LED light uses one.
Components
  • 1 Arduino
  • 3  LED (Red, Blue, Green)
  • 3 Resistor (220Ω)
  • 1 Breadboard
  • 2 black wires for ground
  • 5 orange wires for the inputs

Code

int pin = 13;
int pin0 = 0;
void setup() {
  // setting up the two pins
  pinMode(pin, OUTPUT);
  pinMode(pin0, OUTPUT);
}
void loop() {
  // light up for 1 sec
  digitalWrite(pin, HIGH); //0 VOLTS OR 5
  delay(1000);
  digitalWrite(pin, LOW);
  // turn off for .5 sec
  delay(500);
  digitalWrite(pin0, HIGH); //0 VOLTS OR 5
  // light up for 2 sec
  delay(2000);
  digitalWrite(pin0, LOW);
  // turn off for .5 sec
  delay(500);
}
Photo
Both Red and Blue lights turning on

Both Red and Blue lights turning on

Green LED lights on

Green LED lights on

All lights off

All lights off

Frightened Computing

Description:
Chapter two of Acting With Technology begins by offering that “…recent trends in interaction design include emotion in design, extending usability to include the “pleasurability” of interactive products (Norman 2004) . . . affective computing (Picard 1997), affective design (Aboulafia and Bannon 2004), [and] autonomous characters (Tomlinson 2005) (Dourish 25). Using two LEDs instead of one introduces affective possibility into an otherwise inanimate series of wires and boards by alluding to a pair of eyes; and by coding the lights to temporarily turn off when the circuit is yelled at one creates perhaps the most basic relationship possible—but a relationship nonetheless, and one that a user should probably find emotionally moving. Relationships between humans and computers are often filled with hostility—a computer appears to not be behaving, and so we express our frustration at it. But what if computers responded to yelling with exhibits of fear, meekness, and regret?

 

Components:
• 1 Arduino Uno
• 1 Breadboard
• 2 LEDs
• Jumper Wires
• 1 Battery pack (4 AA)
• 1 SparkFun Electret Microphone Breakout

 

Code:
const int sampleWindow = 250; //250 MS sample width
unsigned int loudNoise;

void setup()
{
pinMode(12, OUTPUT); //these control the LED eyes
pinMode(2, OUTPUT);
Serial.begin(9600);
}

void loop()
{

{
digitalWrite(12, HIGH); //these make the eyes “on” by default
digitalWrite(2, HIGH);
delay(0);
}

unsigned long start= millis(); // start of sample window
unsigned int peakToPeak = 0; // peak-to-peak level

unsigned int signalMax = 0;
unsigned int signalMin = 1024;

while (millis() – start < sampleWindow) // collecting data for 250 MS (can be changed)
{
loudNoise = analogRead(0);
if (loudNoise < 1024) // { if (loudNoise > signalMax) // if there’s a loud noise, save the loud value
{
signalMax = loudNoise;
}
else if (loudNoise < signalMin) // if there’s not a loud noise, don’t save the loud value { signalMin = loudNoise; } } } peakToPeak = signalMax – signalMin; // max – min = peak-peak amplitude double volts = (peakToPeak * 3.3) / 1024; // convert to volts Serial.println(volts); // to know if the mic is working if (volts >=1.0)
{
digitalWrite(2, LOW);
digitalWrite(12, LOW); //eyes shut off
delay(2000); // for a certain amount of time (though this could be modified for more expressive behavior)
Serial.println(“YELLING AT ME”);
}
else
{
digitalWrite(12, LOW);
digitalWrite(2, LOW); //not yetlling at me
}
}