Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: If Else statement when identifying voltage? HELP! Science Fair Project on: November 15, 2012, 11:36:11 am
Jst wanted to say Thanks! He figured out the problem and his Science Fair project is awesome!
2  Using Arduino / Project Guidance / Re: If Else statement when identifying voltage? HELP! Science Fair Project on: November 14, 2012, 06:09:49 pm
He used the charger cord for his phone. He cut the plug off it and wired it into a breadboard. He wired a siren into the breadboard as well. Many headaches later, the siren has been temporarily replaced by an LED. The light is on(siren)but it isn't turning off when the phone is plugged in.

I should preface this by saying tht up until this project, he has never used a board before or programmed anything. He is very smart and willingly perserveres but this one....UGH! My point is that we don't know how to print to the serial port. We don't know how to do much of anything in regard to this. The guy at the store sold him the Uno kit and a book called the Arduino cookbook and sent him on his way.
3  Using Arduino / Project Guidance / Re: If Else statement when identifying voltage? HELP! Science Fair Project on: November 14, 2012, 05:45:34 pm
He's 9. He doesn't have a potentiometer. The phone cord is 5VDC, does that help?
4  Using Arduino / Project Guidance / Re: If Else statement when identifying voltage? HELP! Science Fair Project on: November 14, 2012, 05:39:18 pm
He wants the card to identify when the phone is plugged in. What does he need to use?
5  Using Arduino / Project Guidance / If Else statement when identifying voltage? HELP! Science Fair Project on: November 14, 2012, 05:25:41 pm
Below is the code my 9 year old son is using for his Science Fair project. It is supposed to turn off the siren when the phone is plugged in. It should do this by identify
ing when power is being pulled by the phone. It's not working! It was working and has stopped. His project is due tomorrow and now this awesome project is going to fail. Please help!

long warningThreshold = .001;

const int alarmPin = 9;  //siren
const int plugPin = A0;  //phone

void setup(){
 
  pinMode(alarmPin, OUTPUT);
  pinMode(plugPin, INPUT);
}
void loop(){
 
  int val =analogRead(plugPin);
  if( val = (warningThreshold >= .001)){

      digitalWrite(alarmPin, LOW);
  }
else
  {
    digitalWrite(alarmPin, HIGH);
  }
}
Pages: [1]