Hi,
I am trying to use the GPIO pins on Jetson Nano 2GB for this applications;
- Switching ON and OFF devices. Such as, LED and Buzzer.
- Controlling a servo motor with a servo motor driver module (PCA9685) connected to the SDA and SCL pins (i2c) on Jetson Nano.
However, before I compiled both of the program it works fine individually. Once I compiled both of it, there is an error as shown below.
This are the codes of the program,
import RPi.GPIO as GPIO
import time
from adafruit_servokit import ServoKit
kit=ServoKit(channels=16)
led1=7
led2=11
led3=13
buzz=15
sleepTime=1
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led1,GPIO.OUT)
GPIO.setup(led2,GPIO.OUT)
GPIO.setup(led3,GPIO.OUT)
GPIO.setup(buzz,GPIO.OUT)
while (True):
GPIO.output(led1,True)
time.sleep(sleepTime)
GPIO.output(led1,False)
time.sleep(sleepTime)
GPIO.output(led2,True)
time.sleep(sleepTime)
GPIO.output(led2,False)
time.sleep(sleepTime)
GPIO.output(led3,True)
time.sleep(sleepTime)
GPIO.output(led3,False)
time.sleep(sleepTime)
GPIO.output(buzz,True)
time.sleep(sleepTime)
GPIO.output(buzz,False)
time.sleep(sleepTime)
for i in range(0,180,2):
kit.servo[0].angle=i
time.sleep(.01) #lower = Faster
for i in range(180,0,-2):
kit.servo[0].angle=i
time.sleep(.01)
GPIO.cleanup(led1)
GPIO.cleanup(led2)
GPIO.cleanup(led3)
GPIO.cleanup(led3)
Thank you.