In previous ARTICLE we saw how a four wire resistive touch surface works, and the logic we must implement in order to interface it with a microcontroller. We will see now how is the real implementation with an Arduino and C language. The circuit is really simple. We only have to connect the four wires to the Arduino. Xa to Α0 (PC0 of ATmega328p), Xb to 8 (PΒ0 of ATmega328p), Xb στο Α1 (PC1 of ATmega328p) το Xb to 9 (PΒ1 of ATmega328p).
The code is really simple and well commented. The only the firmware does is to calculate the coordinates of the touch point and sent those data to the UART. Then it can be read by any pc software that can open a serial port, for example. In my case, a simple Python script, that prints the coordinates to stdout.
All the files can be found HERE.