NameError: name 'open' is not defined with Jetson.GPIO on the xavier nx

hello user105768,

may I know the latest status, did you have the servo rotates but not active with the correct degree?
please share your code snippets for reference, thanks

it seems you’ve open another new thread for tracking, let’s check Topic 200639.

Yes @JerryChang , because now the GPIO is fine. in fact it passes all pin checks. So the remaining issue is that one of the new topic. To have the motor turn smoothly and well. Thanks.

@JerryChang, yes. In fact sometimes it doesnt rotate but shakes in place. After a while, sometimes tends to rotate close to fine but sometimes totally wrong. below is the code:

import Jetson.GPIO as GPIO
import time

control = [5,5.5,6,6.5,7,7.5,8,8.5, 9, 9.5, 10]

# control =  [6.25, 7, 7.5, 8, 8.5]

servo = 33 # connect to pwm pin


GPIO.setup(servo, GPIO.OUT)
# in servo motor,
# 1ms pulse for 0 degree (LEFT)
# 1.5ms pulse for 90 degree (MIDDLE)
# 2ms pulse for 180 degree (RIGHT)

# so for 50hz, one frequency is 20ms
# duty cycle for 0 degree = (1/20)*100 = 5%
# duty cycle for 90 degree = (1.5/20)*100 = 7.5% 
# duty cycle for 180 degree = (2/20)*100 = 10%    

p=GPIO.PWM(servo,50) # 50hz frequency

p.start(2.5) # starting duty cycle ( it set the servo to 0 degree )

       while True:
           for x in range(len(control)):
             print control[x]

           for x in range(len(control)-1,0,-1):
             print control[x]

except KeyboardInterrupt:

let’s close this thread and follow-up Topic 200639.

yeah, that’s better.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.