Here is an example of how to use a
TFT screen to control the pan and tilt of a Raspberry Pi camera.
The code can be pulled down to your Raspberry Pi with;
pi@raspberrypi $ git clone http://github.com/mwilliams03/pan-tilt-touchscreen.git ~
There are a number of elements in place to get this working;
Detecting input events on the touchscreen.
The use of double buffering for the framebuffer.
Using fbcp(framebuffer copy) to copy camera image to back buffer. fbcp source has been integrated into the code above.
Updating back buffer with text and buttons.
Forking the actual process that starts recording.
Create a unique file name fore each recording.
Software PWM to control servers. (ServoBlaster)
The code has been well documented, so I will only cover imported snippets below.
The function below is used to draw the buttons and slider outlines to the display.
void drawButton(int x, int y, int w, int h, char *text, int backgroundColor, int foregroundColor);
x & y are the top left coordinates of the button.
w is width.
h is height.
Continue reading Camera Pan and Tilt control with TFT and Touchscreen
Matchbox-keyboard is an on screen ‘virtual’ or ‘software’ keyboard which works well for small touchscreen TFTs connected to a Raspberry Pi.
Matchbox-keyboard also uses XML files to specify the layout of the keys, which makes it highly customizable.
The touchscreen used in the above video is a
Continue reading Virtual Keyboard for the Raspberry Pi
If you are using a touchscreen with your Raspberry Pi, then this guide is for you.
Xstroke (Gesture recognition) is the perfect tool to help you get more out of your touhscreen. I am using a
Gesture recognition allows you to draw “strokes” on your touchscreen, which get interpreted as commands or text. Xstroke allows these to be entered anywhere on the screen. In some cases, Xstroke can be used instead of a keyboard.
Continue reading Raspberry Pi with stroke and Gesture Recognition
In this post I show how to control the GPIO on a Raspberry Pi using a touchscreen.
This is a follow up on my previous post Programming for a Touchscreen on the Raspberry Pi
The TFT doesn’t come up too well in the above video. The picture below gives a better idea of how it looks. Click to enlarge
Link to the code;
In the above code touchbuttons.c creates three buttons on the TFT which will be used to turn on/off three LEDs.
This can easily be changed to add more buttons.
touchbuttons.c also requires WiringPI and needs to be compiled with
gcc -g -o buttonExample buttonExample.c -l wiringPi
Continue reading Controlling the GPIO on a Raspberry Pi with a Touchscreen
To accept input from a touchscreen we have to use the event interface of the Linux input system. We use the ioctl capabilities of the event interface, in addition to the normal read and write calls to get information from the touchscreen. This blog post explains how to use the touchscreen within your own programs using C as well as writing directly to the framebuffer.
Images of my TFT from a previous post;
Continue reading Programming for a Touchscreen on the Raspberry Pi