Sonoff Wifi Switch, GPIO14 and interrupts
-
The Sonoff has a 'spare' GPIO number 14.
I hooked this up to a Hall Effect Water Meter and tried to count the pulses.
The Arduino sketch I wrote works fine on the NODEMCU but doesn't record interrupts on the Sonoff.
For the NODEMCU the board was set as NodeMCU 0.9, for the Sonoff I set it as Generic ESP8266
I'm open to ideas as to why I'm not getting interrupts.
Awaiting your valuable insight -
can you post some code? interrupts work fine with my sonoff:
attachInterrupt(PIN_PIR_SENSOR, ISR_PIRPinHasChanged, CHANGE); void ISR_PIRPinHasChanged(){ int currentPinStatus = digitalRead(PIN_PIR_SENSOR); if(currentPinStatus == LOW){ Serial.println("ISR fired, pin LOW"); } else{ Serial.println("ISR fired, pin HIGH"); ToggleRelay(); } }ISR fired, pin LOW ISR fired, pin HIGH toggling relay to OFF switching off sending status to controller ISR fired, pin LOW ISR fired, pin HIGH toggling relay to ON switching on sending status to controller ISR fired, pin LOW ISR fired, pin HIGH toggling relay to OFF switching off
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login