Sonoff use of extra IO pin

I got the Sonoff working and can control the relay and the led. Now I’d like to take the next step to add a motion sensor on the extra pin. Maybe wrong, but I chose the board as an UNO so there are not I/O above 12. I’ve read that the Sonoff pin is either 14 or 15. I’ve tried the following code to treat it as a virtual pin with no luck. What am I doing wrong? Thanks

CAYENNE_IN(V15){ //Change V0 to whatever your virtual pin number is. Create additional CAYENNE_IN functions for additional virtual pins
Serial.println(“Receiving Data”);
//code here - do whatever you want to do ex digitalWrite
digitalWrite(15,!digitalRead(15));

I need to order one of those for the office already so we can try it out :blush:

Pretty sure @kreggly has some experience with it…maybe he can add something here?

-B

I think you are after gpio 14.

Note from the schematic that 15 is connected to the I/O expander.

GPIO14 is on J1-5.

Cheers,

Craig.

1 Like