It’s now possible to code the Sense HAT for Raspberry Pi in an emulator in a web browser, without any hardware. The Sense HAT emulator allows pupils to run the same Python code that runs on a real Sense HAT on a Raspberry Pi, emulating its behaviour in a virtual on-screen graphic.
The virtual Sense HAT has temperature, pressure and humidity sensors, and can change its behaviour according to the values they report. There are sliders you can move to change these values, so it’s possible to simulate how your code responds to changing environmental variables.
The emulator features:
- LED display
- Environmental controls
- Full Python syntax highlighting
- Contextual auto-complete
- Intuitive error reporting and highlighting
You can then download your project as a ZIP archive so it can easily be moved to a Raspberry Pi. Online projects can be via a direct URL.
The Sense HAT emulator is perfect for use in the classroom where you might have only a few Raspberry Pis or Sense HATs. The emulator allows all pupils to write code for the virtual Sense HAT, and they can then take turns running their code on a real one.
The emulator runs on any computer via a web browser, and it doesn’t use Flash so it’ll work fine on iPads and other tablets too.
For more on this, check out this post from Ben Nuttal on the Open Source blog.