was thinking about using the multiplex idea for testing if there is a chesspiece (or several) on an existing board.
I want to fit all my pieces with a strong magnet on the bottom. use little reet switches under the board and by using 8 digital inputs on the A-H line and toggle 5v on the 1-8 lines one by one I should be able to see if a square holds a piece or not. Am I missing something?
Probably need to add diodes as well to help with isolation when reading a row or column in.
Take one output low, read the 8 inputs, see which are low. output back high.
Take next output low, read the 8 inputs, output high.
Repeat for all 8 outputs.
using 8 digital inputs on the A-H line and toggle 5v on the 1-8 lines one by one
Depending on the Arduino that you are using you will soon run out of pins. Consider using a shift register for either one or both axes and bit manipulation to read the variable(s) returned.
He'll still have 4 left. 2 for serial, 2 for something else. Hasn't indicated the program is doing anything else.
working on a mega, the program is doing not much else apart from speaking to an I2C display. But even so it could work on an UNO.
Thanks for the help. I've tested it with 4 squares and it works, only thing to do now is scale it up.
At the moment I am using LEDS as diodes, because i don't have diodes.
Is there anything special i should look out for when buying diodes? (5v, seperate power supply 2A)