As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Thursday, June 4, 2015

Code: adjusting settings

After testing the code out a couple of times, we somehow created the pins 8-12 to not work. So we had to adjust our code so the new pins are 1-5. We also adjusted the sensitivity to how the LED bulbs would react as well. This is all because we did something earlier in the process, where we perhaps short circuited the arduino and caused us to have to re attach everything and almost start from the beginning. 

// Arduino pin numbers 
//const int DO_pin = 2;
 const int AO_pin = 0; 

int sound; 

int led1 = 5; 
int led2 = 4;
 int led3 = 2; 
int led4 = 3; 
int led5 = 1; 

void setup() 
{ //pinMode(DO_pin, INPUT); 
 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT); 
 pinMode(led3, OUTPUT); 
pinMode(led4, OUTPUT); 
pinMode(led5, OUTPUT); 

 Serial.begin(9600); } 

 void loop() { 
if (sound > 36) 
{ digitalWrite(led1, HIGH); } 
if (sound < 36) { digitalWrite(led1, LOW); } 
if (sound > 40) { digitalWrite(led2, HIGH); }
 if (sound < 40) { digitalWrite(led2, LOW); } 
if (sound > 45) { digitalWrite(led3, HIGH); } 
if (sound < 45) { digitalWrite(led3, LOW); }
 if (sound > 50) { digitalWrite(led4, HIGH); }
 if (sound < 50) { digitalWrite(led4, LOW); }
 if (sound > 55) { digitalWrite(led5, HIGH); }
 if (sound < 55) { digitalWrite(led5, LOW); }

 sound = analogRead(AO_pin)* 0.1;
 //Serial.print(digitalRead(DO_pin)); 
Serial.print("-"); Serial.println(analogRead(AO_pin)); }

1 comment: