Friday 5 February 2010

The working Model Complete

I managed to get my push button working to a certain extent but enough for PLAY crit on monday.

The problems with a non latching switch, or push button, is as follows:
  1. switches deal with on / off signals or HIGHS and LOWS. A latching switch is always either fully HIGH or fully LOW. Think of a light switch; it has a position to be switched to, to do the action required. A non latching switch has no correct position i.e. the HIGH and LOW share the same position.
  2. this causes problems as when the switch is not pressed, it equals LOW. When you press down it = HIGH then returns to a LOW signal in it's original position. This produces problems as the signal is as long as the switch being pressed down.
  3. This means it is not a steady action.
So when i state:
if (buttonawake == LOW){ //if button is not pushed do the following...
//solenoid loops
But when i want it to do something else:
else if (buttonawake == HIGH){ // has the button been pressed?
digitalWrite(solenoid,LOW); //turn everything off

This would work for as long as i held the button down. When i released, the solenoid would resume action.

I got around this by adding a 1 minute delay, so by the time it wants to turn the solenoids back on with the button released, the alarm signal is over so will not signal.

else if (buttonawake == HIGH){ // has the button been pressed?
digitalWrite(solenoid,LOW); //turn everything off
delay(60000); //wait 1 min

No comments:

Post a Comment