This is the sketch:
// Example code for Centipede Library
// Works with Centipede Shield or MCP23017 on Arduino I2C port
/* Available commands
.digitalWrite([0...127], [LOW...HIGH]) - Acts like normal digitalWrite
.digitalRead([0...127]) - Acts like normal digitalRead
.pinMode([0...127], [INPUT...OUTPUT]) - Acts like normal pinMode
.portWrite([0...7], [0...65535]) - Writes 16-bit value to one port (chip)
.portRead([0...7]) - Reads 16-bit value from one port (chip)
.portMode([0...7], [0...65535]) - Write I/O mask to one port (chip)
.pinPullup([0...127], [LOW...HIGH]) - Sets pullup on input pin
.portPullup([0...7], [0...65535]) - Sets pullups on one port (chip)
.init() - Sets all registers to initial values
int recpin = CS.digitalRead(0);
CS.portMode(0, 0b0111111001111110); // 0 = output, 1 = input
CS.portWrite(0, 0b1000000110000001); // 0 = LOW, 1 = HIGH
int recport = CS.portRead(0);
CS.portPullup(0, 0b0111111001111110); // 0 = no pullup, 1 = pullup
Centipede CS; // create Centipede object
Wire.begin(); // start I2C
CS.initialize(); // set all registers to default
CS.portMode(0, 0b0000000000000000); // set all pins on chip 0 to output
//TWBR = 12; // uncomment for 400KHz I2C (on 16MHz Arduinos)
It doesn’t yield any outputs from the pins.
The 12 side of things is sort of like this:
12v 2A SMPS
1 - Arduino and 2 shields.
2 - Vero board
3 - (not yet connected)
12 v in.
2 x “relay drive circuits” which are two transistors arranged darlington style to drive a small 2p2t/co relay.
Flyback diodes, etc ALL included.
One of the contacts from said relay then goes to drive another 12v relay with 240V contacts AND light an LED.
The LED also has a small "trickle voltage constantly so it “glows in the dark” - making it easier to see/find.
(See http://arduino.cc/forum/index.php/topic,113214.new.html#new ) since resolved.
The other (second) relay with the 240 volt contacts also has flyback diodes on it/them.
The 7805 is powered from the 12v rail - no decoupling. I tried two caps and they died after I went to extreme lengths to put them on/in the circuit. I’m guessing that because they are 15+ years old didn’t help.
So, there is the small blue cap which is on the output of the 7805 - see picture in previous post.
There is nothing else on the output of the 7805 and it ONLY powers this MCP chip and associated resistors which go to the MPC’s pins anyway.
Now a question about the I2C bus wires:
Ok, ribbon cable is not a good thing. But I have two wires going from one place - beside each other - to another place, arriving beside each other. Using two “discreet” wires would be annoying in that they wouldn’t stay together and so would cause problems in that sense - or something like that.
Anyway, I need to get back to things and cut that track better and use that test sketch and see what happens.