Files
CARIA-AUTOMOTIVE/WebControl/apps/infrared_tracking_objects.py
ccunatbrule 9ae7f229e7 CARIA.2.0
Repo initial CARIA :
MAJ Interface Bootle amélioré
- Optimisation de la structure
- amélioration des fonctionnalités
- debug
. . .
2024-05-28 15:47:08 +02:00

36 lines
690 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
import sys
sys.path.append('/home/christian/WebControl/modules/')
from AlphaBot import AlphaBot
Ab = AlphaBot()
DR = 16
DL = 19
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(DR,GPIO.IN,GPIO.PUD_UP)
GPIO.setup(DL,GPIO.IN,GPIO.PUD_UP)
Ab.stop()
speed=100
try:
while True:
DR_status = GPIO.input(DR)
DL_status = GPIO.input(DL)
if((DL_status == 0) and (DR_status == 0)):
Ab.forward(speed)
elif((DL_status == 1) and (DR_status == 0)):
Ab.right(speed)
elif((DL_status == 0) and (DR_status == 1)):
Ab.left(speed)
else:
Ab.stop()
except KeyboardInterrupt:
GPIO.cleanup();