|
Main Links:
Final Projects
|
Main /
BryanWallFinal Project
CODE: int hueIn = 0; int hueInPin = 5; int highestHue = 0; int brightIn = 0; int brightInPin = 4; int highestBright = 0; int rMax = 103; int gbMax = 180; int interval = 200; long lastTime = 0; int redValues[8] = {103, 103, 103, 0, 0, 60, 103, 103}; int greenValues[8] = {0, 40, 180, 180, 0, 0, 0, 180}; int blueValues[8] = {0, 0, 0, 0, 180, 180, 100, 180}; void setup(){ Serial.begin(9600); pinMode(startPin, OUTPUT); blink(startPin, 3, 300); testColors(); } void loop(){ hueIn = analogRead(hueInPin)/128;
brightIn = analogRead(brightInPin)/51;
if (hueIn > highestHue){
highestHue = hueIn;
}
if(brightIn > highestBright){
highestBright = brightIn;
}
Serial.println(highestBright);
if(millis() - lastTime > interval){
lastTime = millis();
if(highestHue == 7){
analogWrite(redPin, redValues[7]/(highestBright+1));
analogWrite(greenPin, greenValues[7]/(highestBright+1));
analogWrite(bluePin, blueValues[7]/(highestBright+1));
}else if(highestHue == 6){
analogWrite(redPin, redValues[6]/(highestBright+1));
analogWrite(greenPin, greenValues[6]/(highestBright+1));
analogWrite(bluePin, blueValues[6]/(highestBright+1));
}else if(highestHue == 5){
analogWrite(redPin, redValues[5]/(highestBright+1));
analogWrite(greenPin, greenValues[5]/(highestBright+1));
analogWrite(bluePin, blueValues[5]/(highestBright+1));
}else if(highestHue == 4){
analogWrite(redPin, redValues[4]/(highestBright+1));
analogWrite(greenPin, greenValues[4]/(highestBright+1));
analogWrite(bluePin, blueValues[4]/(highestBright+1));
}else if(highestHue == 3){
analogWrite(redPin, redValues[3]/(highestBright+1));
analogWrite(greenPin, greenValues[3]/(highestBright+1));
analogWrite(bluePin, blueValues[3]/(highestBright+1));
}else if(highestHue == 2){
analogWrite(redPin, redValues[2]/(highestBright+1));
analogWrite(greenPin, greenValues[2]/(highestBright+1));
analogWrite(bluePin, blueValues[2]/(highestBright+1));
}else if(highestHue == 1){
analogWrite(redPin, redValues[1]/(highestBright+1));
analogWrite(greenPin, greenValues[1]/(highestBright+1));
analogWrite(bluePin, blueValues[1]/(highestBright+1));
}else{
analogWrite(redPin, redValues[0]/(highestBright+1));
analogWrite(greenPin, greenValues[0]/(highestBright+1));
analogWrite(bluePin, blueValues[0]/(highestBright+1));
}
highestHue = 0;
highestBright = 0;
}
} void blink(int whatPin, int howManyTimes, int milliSecs) { int i = 0;
for ( i = 0; i < howManyTimes; i++) {
digitalWrite(whatPin, HIGH);
delay(milliSecs/2);
digitalWrite(whatPin, LOW);
delay(milliSecs/2);
}
} /*Run a test of all Colors*/ void testColors(){ analogWrite(redPin, 103); delay(800); analogWrite(redPin, 0); analogWrite(greenPin, 180); delay(800); analogWrite(greenPin, 0); analogWrite(bluePin, 180); delay(800); analogWrite(bluePin, 0); analogWrite(redPin, rMax); analogWrite(greenPin, gbMax); analogWrite(bluePin, gbMax); } Week 1: Observation I stalked around a bit and tried to watch the people who live in my building as they exited our building. I was looking for actions such as checking for keys or patting of pockets. I also followed my roommate a few times when he left to go get groceries. Since we hang out quite a bit anyways, it was not conspicuous to watch his behavior, though my presence no doubt affected it. The only consistent behavior I noticed is that people do not give much notice to the act of leaving the building. We have a lot of homeless people on our block, and the only time my roommate even spoke aloud when we exited the building was to remark on how great it was the few times there was no one sitting on the stoop. The physical characteristics of our medium are the door and the user, and their interaction. The physical input is the user turning the knob to open the door. Week 2: Prototyping We've got the design for our alert system completed, we're just waiting on getting the parts now. We've got a magnetic door switch to turn the system on when the door is opened as well. We're going to use low frequency RFID for the proximity detection of the keychain. We're currently looking at buying these from Texas Instruments: The Keyring Tag and the Micro Reader Week 3: More Prototyping We almost completely lost our minds this week trying to get our RFID readers to work. After many failed days and attempts with the Texas Instruments reader, we gave up and moved on to the Parallax reader so we would have something to show for class. The range is not great, and would not make a functional product, but the idea is evident from the prototype. Week 4: Final Midterm So we're back with the TI reader, having found out that all of our issues were due to a faulty chip. That's pretty irritating. The loop() function of the arduino was giving us some issues because the chip wants to keep using that loop and will not allow a separate while() to run exclusively. We spent several nights on and off working on code, and finally have a nice looking midterm, with a tupperare enclosure!
![]() Tuesday, September 19. 3:00 pm. Washington Square Park Notes - The user's headphones remained plugged in. - The user alternated between periods of continuous use and periods of staring with her left hand on her face. - The user always used her right index finger, which moved in short, smooth arcs across the touch pad. - The movement of the index finger was typically around 5 quick movements in a row, then a tap or two, then several seconds of rest. - Sample period: 5 movements, 2 taps, 8 seconds rest, 2 movements, 3 seconds rest, 11 movements, 2 taps, 2 seconds rest. - The user's feet tapped in an alternating pattern throughout the entire time of use. - When the user clicked the mouse button, she did not click with her right thumb, but rather clicked with her left index finger as she used the touchpad with her right index finger.
potValue = analogRead(potPin); // read the pot value line of code reads in the varying Voltage from the potentiometer, not the varying resistance. |