Came home to my IO module showing me an on status (dot) on port 2 So I unhooked the switch. I already have 1 switch that is flaky so figured another flaky switch. Port still stayed on with switch disconnected. Rebooted RA+ port still on. I had to unplug/replug the data cable from the IO Mod to clear it. Any Ideas?
Nick
IO module port 2 stuck on even when disconnected
-
- Posts: 289
- Joined: Wed May 16, 2012 9:52 pm
IO module port 2 stuck on even when disconnected
180G FOWLR
20GH QT#1
29G QT#2

20GH QT#1
29G QT#2
Re: IO module port 2 stuck on even when disconnected
Let's add watchdog to your module.
Upload this code to your I/O module.
Open the case and plug the cable with the black wire on the GND marking.
Make sure you pick "Reef Angel Controller w/ optibbot" board before you try uploading.
Code: Select all
#include <Wire.h>
#include <avr/wdt.h>
byte IOports[] ={
3,5,6,9,10,11};
byte IOOut=0;
void setup()
{
wdt_enable(WDTO_1S);
Wire.begin(9);
Wire.onRequest(requestEvent);
for (int a=0;a<6;a++)
{
pinMode(IOports[a],INPUT);
digitalWrite(IOports[a],HIGH); //pull up resistor
}
}
void loop()
{
wdt_reset();
}
void requestEvent() {
IOOut=0;
for (int a=0;a<6;a++)
{
IOOut+=digitalRead(IOports[a])<<a; //pull up resistor
}
Wire.write(IOOut);
}
Open the case and plug the cable with the black wire on the GND marking.
Make sure you pick "Reef Angel Controller w/ optibbot" board before you try uploading.
Roberto.