Video of problem: problem - YouTube
Image:
Essentially the 9 buttons represent a cordinate on the board. 1st button = topleft, 2nd button = top mid etc...
The variable and function names in unfortunately in Swedish but it should be understandable either way.
Röd = Red
Blå = Blue
Rad = Row
Kolumn = Column
I have made a sketch code which tested the hardware and it works as expected, thus the problem lies within the code. The problem as shown in the video is that if the ai (red) places on a row (x-axis) all player leds (blue) will be turned off, however they are still registered and the program can detect the win either way. I'm certain the problems lies within UppdateraLampor(); considering the positions are still registered within the array and the only problems is the leds being turned off.
Code: Video of problem: https://www.youtube.com/watch?v=obc3EzFlp9E&ab_channel=JonCed - Pastebin.com or in attached .ino file.
1.3.ino (8.08 KB)