Example programs using the Sense HAT - particularly for the Astro Pi competition
British ESA astronaut Tim Peake is going to the International Space Station for 6 months at the end of 2015 and taking two Raspberry Pi computers to run experiments coded by participants in the Astro Pi coding competition for UK schools.
The Sense HAT is the hardware attachment board mounted to the Pis on the ISS, and will be available to the public as a product soon.
The Raspberry Pi Foundation have created a Python API to provide access to the board's LED matrix and sensors. See the documentation at pythonhosted.org/sense-hat
With a Sense HAT on a Raspberry Pi, and the firmware and Python library installed (see Sense HAT software installation), download or clone this repository, enter the python
directory and run the examples with Python 3 or Python 2.
e.g.
git clone git://github.com/bennuttall/astro-pi-examples
cd astro-pi-examples/python
python3 random_sparkles.py
Let your Sense HAT shine with pride
Conway's Game of Life is a zero-player cellular automaton game
The game is randomly generated each time. Some games will be over very quickly, others will last a few generations. Press Ctrl + C
to quit and then run it again.
Walk around a Minecraft world and the Sense HAT will light up the colour of the block you're standing on
Be sure to open a Minecraft world first
Walk around a Minecraft world and the Sense HAT will show an 8x8 map of your player's surroundings
Be sure to open a Minecraft world first. Note blocks are cached for speed so alterations are not accounted for.
Two colours are selected at random and shown on the Sense HAT - controlling the RGB values with the keyboard you have to try to match the middle squares with the outside colour
Keys:
r: increase red
t: decrease red
g: increase green
h: decrease green
b: increase blue
n: decrease blue
esc: give up
One line jokes scrolling on your Sense HAT display
Choose your own jokes list
One line programmer jokes scrolling on your Sense HAT display
Requires pyjokes
Stream a scaled-down picture from the camera module to the Sense HAT's LED matrix
Requires a camera module
Show a bar graph of the temperature in real time
Show a bar graph of the humidity in real time
All examples provided are free to use for any purpose, with or without attribution.