Blue Pill based Dino game player

This weekend I dusted out my old blue pill board to try HID keyboard example.

The controller present in blue pill board ( STM32F103C8T6 ) can act as USB client, so we can program it act as a regular keyboard to computer. There is a standard example available in this repo. Once I got the standard example working, I tried to implement a small dino (the game that comes in chrome when system is offline) player using it.

Dino player

The working is simple, we place LDR sensor near the screen (with a pull down resistor) and read the voltage in a continuous loop. When ever there is obstacle on the screen, we will see a voltage spike (LDR resistance increases as light intensity reduces). Our program will be monitoring for this voltage spike and sends ‘space’ key to the host when it finds voltage spike.

LDR circuit
LDR circuit

You might need to do some trail and error to get placement and threshold right.

Add a Comment

Your email address will not be published. Required fields are marked *