PI-62IntermediatePremium

Raspberry Pi Pico Number Puzzle: Crack the 4-Digit Code (KY-040 + TM1637 + 2 LEDs + Buzzer)

The Pico picks a secret 4-digit number with no repeated digits, and you have to find it. Turn the KY-040 knob to pick a digit and press to move on; the TM1637 display answers with a clue like "+2 −1": 2 digits in the right place, 1 digit in the number but in the wrong place. A green and a red LED blink out the plus and the minus while the buzzer plays along. You get 10 tries, and with puzzle numbers P 01–P 99 you can race a friend on the same number.

0.0(0)
Raspberry Pi Pico Number Puzzle: Crack the 4-Digit Code (KY-040 + TM1637 + 2 LEDs + Buzzer)
The number puzzle from the back pages of school notebooks, now on your desk: the Pico picks a 4-digit number with all different digits, and you turn a knob to guess it. A clue like "+2 −1" means two digits are in the right place and one is in the number but in the wrong spot; a green and a red light blink out the same answer. Pick the same puzzle number as a friend and see who needs fewer guesses.

Source Code

Premium Content

The source code, block version and FAQ of this project are open to Premium members.

  • All Project Code
  • Block version
  • Frequently Asked Questions