What is it?The Skywriter is a nifty little add on that enables you to control your Raspberry Pi A+ or B+ with a flick of the wrist! The Pimoroni Skywriter HAT senses the position of your fingers in the air above and responds to a range of hand movements and gestures. Using the provided Python API you can read off the positional data (x, y, z) and common gestures like flick left, tap, and double tap.
1. Getting StartedLoad the LX Terminal:
sudo apt-get update sudo apt-get upgrade To get stared with this project you need to firstly install the python smbus, type sudo apt-get install python-smbus, (After installation I then restarted Pi). Then the i2c needs enabling, this can be done with a simple bash script provided by Pimoroni, curl -sSl get.pimoroni.com/i2c | bash Next step restart your Pi to enable the smbus and when loaded, re-open the LX Terminal and install the Skywriter Python Library, typing:
sudo apt-get install python-pip sudo pip install skywriter Once install then reboot your Pi typing, sudo reboot 2. A Starting ProgramWith your Skywriter connected to the GPIO pins of your Raspberry Pi try this simple Python program below. It allows you to double tap the Skywriter and prints out the position of the double tap back to the console screen. For example, center, west, east, north and so on. Copy and paste the code into IDLE, press F5 to save the code and run it.
@skywriter.double_tap() def doubletap(position): print('Double tap!', position) Download the code here |
The SkywriterOther Skywriter ControlsPimoroni have created an excellent library of examples to get you started with the Skywriter, these can be found here. The controls below are taken from their test.py program which demonstrates all the movements and interactions with the user and the Skywriter.
Slow down: You can slow down the responsiveness of the Skywriter using the following code, repeat_rate=2, where the number 2 is the of number of permitted touches a second. For example to enable a maximum of 3 touches a second code, @skywriter.touch(repeat_rate=2) def touch(position): print('Touch!', position) X Y Z Position: This code returns the X, Y and Z position of your finder on the Skywriter, the Y axis is response up to about 5cm @skywriter.move() def move(x, y, z): print( x, y, z ) The Flick: Flick your finger across the Skywriter and the code returns the location of the flick, south to north, west to east or vice-versa. @skywriter.flick() def flick(start,finish): print('Got a flick!', start, finish) The Tap: Like the double tap but a activated with a single tap. @skywriter.tap() def tap(position): print('Tap!', position) The Touch: This code returns the position where you touched the Skywriter. @skywriter.touch() def touch(position): print('Touch!', position) |
- Home
- Python
- Ras Pi
-
Pi Hardware
- Pi-Hacks
-
Pi-Hacks 2
- The Joker
- Hologram Machine
- Google Vision: Camera Tell
- Yoda Tweets
- Pi Phone
- Darth Beats
- Twitter Keyword Finder
- Crimbo Lights Hack
- Xmas Elf
- Halloween 2016
- Halloween Hack 2015
- Socrative Zombie
- Voice Translation
- The Blue-Who Finder
- GPIO, Twitter
- Pi Chat Bot >
- PiGlow & Email
- Pibrella Alarm System
- SMS with Python >
- Pi-Hacks 3
- Minecraft
- Computing
- Contact Me
- Random Hacks