Skip to content

Commit

Permalink
v2.2
Browse files Browse the repository at this point in the history
- Updated strategy for more reliable digitalRead operations and support for high impedance scenarios. You should now use GND instead of +5v for your status sensing circuitry.
  • Loading branch information
yanavery committed Dec 16, 2012
1 parent 7ad088d commit 2ed7d4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MyDoorOpener/MyDoorOpener.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ static const uint8_t statusPins[] = { 3 }; // single device at pin #3

#define STATUS_STRATEGY_3VCLOSED_5VOPENED // initial approach - uses analogRead combined with STATUS_OPEN_TRESHOLD (opened == +5v, closed == +3v)
//#define STATUS_STRATEGY_5VCLOSED_3VOPENED // alternate approach - uses analogRead combined with STATUS_OPEN_TRESHOLD (opened == +3v, closed == +5v)
//#define STATUS_STRATEGY_NORMALLY_CLOSED // classic door sensor - uses digitalRead to interpret door/device status (opened == high-impedance, closed == +5v)
//#define STATUS_STRATEGY_NORMALLY_OPENED // alternate approach - uses digitalRead to interpret door/device status (opened == +5v, closed == high-impedance)
//#define STATUS_STRATEGY_NORMALLY_CLOSED // classic door sensor - uses digitalRead to interpret door/device status (opened == high-impedance, closed == GND)
//#define STATUS_STRATEGY_NORMALLY_OPENED // alternate approach - uses digitalRead to interpret door/device status (opened == GND, closed == high-impedance)

// Analog boundary value (0-1023) used to distinguish between device/door status == opened and closed. Only applicable
// when STATUS_STRATEGY_3VCLOSED_5VOPENED or STATUS_STRATEGY_5VCLOSED_3VOPENED is being used.
Expand Down Expand Up @@ -383,7 +383,7 @@ void configureStatusPin(int pinNumber)
#if defined(STATUS_STRATEGY_3VCLOSED_5VOPENED) || defined(STATUS_STRATEGY_5VCLOSED_3VOPENED)
pinMode(pinNumber, INPUT);
#elif defined(STATUS_STRATEGY_NORMALLY_CLOSED) || defined(STATUS_STRATEGY_NORMALLY_OPENED)
pinMode(pinNumber, INPUT_PULLUP);
pinMode(pinNumber+14, INPUT_PULLUP); // addressing analog pins as digital pins (+14)
#endif
}

Expand Down

0 comments on commit 2ed7d4e

Please sign in to comment.