ghans wrote:How do you count the pulses ? Via camera or is something
connected to the GPIO ?
I added a main loop that recorded the time since the last transition of a GPIO line. I also saved the last 4 time measures for every GPIO line. Once the change of a tile was from light to dark so that the (dark time) > 1.5 * (shortest light time) then I knew that the peg was on a certain place on the screen. This then triggered a move of a peg, choosing an orc, barrel or something to be targetted. The next light to dark transition did then trigger the actual fight or open the chest.
In addition to this I had two buttons connected to GPIO wires:
- open a door button
- end your turn button.
Nothing else was needed for playing the game. Just 3 GPIO lines and a €3 light to frequency chip glued on the bottom of the playing piece. I finally had 3 very thin wires braided together to make a wired contact to PiZero (3.3V, GPIO IN, GND). Look at the blue line in the pic above. The DiscoCap board had proper pull-up resistors for the buttons. I also coded in the hysteresis algorithm to my game (mentioned in some of my other posts) to get rid of spurious signals.
The reason I abandoned IR was that some blue smoke escaped the IR reading hardware and there was no time to buy replacements. So I just changed plans and moved to wired data transfers.
PS. I also bought a camera module on Friday morning but it was dead on arrival. The software recognized it but it refused to digitize anything. So I had to abandon IR completely. That is how things usually are. BIG PANIC a few hours before being on stage. I love the excitement.