By placing 5 LDRs in a line, and flashing a different coloured RGB LED onto the face of a card, we’re hoping to read the numerical value and the suit of the card using our PIC microcontroller.
The numerical value of the card can be displayed as a 4-bit binary representation of the number. So, for example, an Ace has the numerical value 1, which is represented by 0001. Similarly, a five would be 0101 and so on. Whether we use a black dot or a white dot as a “one” in our binary representation doesn’t really matter!
(yes the binary dots don’t match the value on the card, and blue is traditionally associated with diamonds, not clubs, but this was just a quick mock-up provided to us to demonstrate a basic idea!)
We’re going to use the colours:
- black = spades
- red = hearts
- green = clubs
- blue = diamonds
Here’s a chart showing what we’d expect to see on each LDR and the card value we could deduce from it: