Here is an example of how to use a TFT screen to control the pan and tilt of a Raspberry Pi camera.
Git repository here
The code can be pulled down to your Raspberry Pi with;
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.
Drawing buttons
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