Gesture-controlled car 

We have seen how we can extract the data from IMU. Now its time to put that data to work. In this chapter we will be controlling our robotic vehicle just with the tilt of our hand. So in essence it will be a gesture-controlled robotic vehicle. Now to do so, lets go ahead and connect the Raspberry Pi as follows:

Make sure you attach a sufficiently long wire for the sensor, do not exceed 1 meter at any point and use it as a remote control for your vehicle. Once connected upload the following code:

import smbusfrom time import sleepimport RPi.GPIO as GPIOint1 = 12int2 = 16int3 = 18int4 = 15GPIO.setup(int1, GPIO.OUT)GPIO.setup(int2, ...

Get Python Robotics Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.