Changes

Students/KimBeswick

766 bytes added, 20:29, 18 March 2010
no edit summary
The project is metaphorical, the technology of the speaker serving image and the image serving language, so really, it's an old-fashioned sort of project. The cookie jar is meant to have a very kitschy quality, Yudof looking rosy cheeked and benevolent like he knows what's best for everyone.
 
This is the code:
int sensorPin = 2; // this is for the light sensor input
int powerPin = 5; // this is the output pin for the audio
int sensorValue = 0; // variable to store the value coming from the sensor
int threshold = 100; // threshold for analog input of light sensor
 
 
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(powerPin, OUTPUT); // to power the sound chip
Serial.begin(9600); // analog to serial monitor
}
 
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if(sensorValue > threshold){
digitalWrite(powerPin, HIGH);
}else{
digitalWrite(powerPin, LOW);
// arduino will supply power unless the threshold is below 100
}
delay(100);
}
Here is the sound chip:
20
edits