Umstellung auf externen Pullup-Widerstand
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
/* Klingel-Sensor auf Arduino Nano ATmega168
|
||||
*
|
||||
* https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
|
||||
* https://elektro.turanis.de/html/prj035/index.html
|
||||
*
|
||||
* D2 -------------
|
||||
* | |
|
||||
* Button |
|
||||
* 10kOhm |
|
||||
* | |
|
||||
* +5V ----- |
|
||||
* 10kOhm
|
||||
* Button
|
||||
* |
|
||||
* GND -------------
|
||||
*/
|
||||
@@ -29,17 +30,17 @@ void setup() {
|
||||
void loop() {
|
||||
int val = digitalRead(buttonPin);
|
||||
|
||||
if (val == HIGH) {
|
||||
if (val == LOW) {
|
||||
delay(flare_threshold); // catch flares
|
||||
val = digitalRead(buttonPin);
|
||||
|
||||
if (val == HIGH && active == false) {
|
||||
if (val == LOW && active == false) {
|
||||
Serial.println("RING");
|
||||
digitalWrite(ledPin, HIGH);
|
||||
active = true;
|
||||
delay(ring_delay);
|
||||
}
|
||||
else if (val == LOW) {
|
||||
else if (val == HIGH) {
|
||||
Serial.print("flare (<");
|
||||
Serial.print(flare_threshold);
|
||||
Serial.println(")");
|
||||
|
||||
Reference in New Issue
Block a user