Code: Select all
#!/bin/bash
gpio mode 1 out
gpio mode 2 out
gpio write 1 0
gpio write 2 0
while true
do
read -n 1 -s x
case $x in
[w]*)
gpio write 1 1
gpio write 2 1
echo "forward"
;;
[s]*)
gpio write 1 0
gpio write 2 0
echo "stop"
;;
[a]*)
gpio write 1 0
gpio write 2 1
echo "right"
;;
[d]*)
gpio write 1 1
gpio write 2 0
echo "left"
;;
esac
echo "You have pressed $key"
done
Code: Select all
import RPi.GPIO as GPIO
import time
import signal
import Tkinter as tk
from pizypwm import *
first_f = PiZyPwm(0.01, 100, 12, GPIO.BOARD)
second_f = PiZyPwm(0.01, 100, 13, GPIO.BOARD)
first_f.start(50)
second_f.start(50)
time.sleep(1)
first_f.stop()
second_f.stop()
Could anyone help me please?
Thank you for any answer and sorry for my bad english.