Monday, November 1, 2010

Midterm Project

Midterm Project Proposal
This is the device that help hikers or campers on their activities. This is a shoulder automatic flash light, which is it sensor the light of the environment, if the environment gets too dark and is hard for vision, the light will automatically turn on. It can be put on the backpack, on the hat, or anywhere that make efficient to the user. It helps hikers and campers on their activities if they are not aware the changes of the environment, especially in the nature.

below is the code:
============================================================================
int sensorValue = 0; // photoresistor on Analogue Pin 1 int lightbulb = 9; // Light Bulb on Digital Pin 9 int aiValue = 0; // input value int setPoint = 900; // Trigger value
void setup(){ pinMode(lightbulb, OUTPUT); // Configure the Digital Pin Direction for the LED }

void loop() { aiValue = analogRead(sensorValue); // Read the analogue input value
if (aiValue < setPoint){ digitalWrite(lightbulb, LOW); // It has got dark, turn the light on. }
else{ digitalWrite(lightbulb, HIGH); // It is light again, turn the light off. }
}

=====================================================================================






No comments:

Post a Comment