I bought this car in a second-hand-stuff shop. Originally it was remote-controlled but when I bought it, it no longer had the remote control. I don’t know the motor specification. This car has five AA batteries (7.5V), so I think it is safe to use my 5V power source. I put it on a box to avoid it to run away.
This time I used the L293D attached to GPIO 18 and 23 in a way I can make the motor run forwards or backwards.
I used the Servo Blaster library as presented on Day 14. In order to run the motor forwards, I kept one signal at zero and changed the other one.
echo "2=0" > /dev/servoblaster echo "5=500" > /dev/servoblaster
To run backwards, I inverted the signals:
echo "5=0" > /dev/servoblaster echo "2=500" > /dev/servoblaster
It worked with values from 300 to 2000.
When the motor runs forwards, the white LED is on. The LED is connected after the L293D.
When the motor runs backwards, the green LED is on. The LED is connected before the L293D.