EasyManuals Logo

Freenove 4WD Smart Car Board for Raspberry Pi User Manual

Default Icon
132 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #72 background imageLoading...
Page #72 background image
Need support? support.freenove.com
68
Chapter 3 Module test (necessary)
The code is as below:
1
2
3
4
5
6
7
8
9
10
11
12
from Infrared_Obstacle_Avoidance import *
def test_Infrared():
try:
while True:
if GPIO.input(IR01)!=True and GPIO.input(IR02)==True and GPIO.input(IR03)!=True:
print 'Middle'
elif GPIO.input(IR01)!=True and GPIO.input(IR02)!=True and GPIO.input(IR03)==True:
print 'Right'
elif GPIO.input(IR01)==True and GPIO.input(IR02)!=True and GPIO.input(IR03)!=True:
print 'Left'
except KeyboardInterrupt:
print "\nEnd of program"
Reference
GPIO.input(IO)
This function has an input parameter. If the IO input is high level, GPIO.input(IO) returns True. If the IO input
is low level, GPIO.input(IO) returns False.

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove 4WD Smart Car Board for Raspberry Pi and is the answer not in the manual?

Freenove 4WD Smart Car Board for Raspberry Pi Specifications

General IconGeneral
BrandFreenove
Model4WD Smart Car Board for Raspberry Pi
CategoryMicrocontrollers
LanguageEnglish