In the previous chapter we have seen that we are making the car turn in any of the directions just based on our hand movements, however there is a problem with the previous code. Firstly the car is moving in one direction at a time, that is it's going either forward or backward or turning left or right.Â
It was not able to make a banking turn based on the hand gestures itself. To make it capable of doing so, we need to make the code even smarter. The overall connections to the robot would be exactly the same. But the code would be slightly different, so let's see what it is:Â
import smbus
from time import sleep
import RPi.GPIO as GPIO
int1 = 12
int2 = 16
int3 = 18
int4 = 15
GPIO.setup(int1, GPIO.OUT)
GPIO.setup(int2, GPIO.OUT)
GPIO.setup(int3, GPIO.OUT)
GPIO.setup(int4, GPIO.OUT)
PWM1 = GPIO.PWM(12, 100)
PWM2 = GPIO.PWM(16, 100)
PWM3 = GPIO.PWM(18...