|
楼主 |
发表于 2023-5-26 15:31:30
|
显示全部楼层
gpio 配置了,可以驱动LED闪烁。 管脚有波形输出,但是不对,。代码如下:
import Jetson.GPIO as GPIO
import time
output_pins = {
'JETSON_XAVIER': 18,
'JETSON_NANO': 33,
}
output_pin = output_pins.get(GPIO.model, None)
if output_pin is None:
raise Exception('PWM not supported on this board')
def main():
# Pin Setup:
# Board pin-numbering scheme
GPIO.setmode(GPIO.BOARD)
# set pin as an output pin with optional initial state of HIGH
GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)
p = GPIO.PWM(output_pin, 50) # 50Hz
p.start(25) # 25% duty cycle
print("PWM running. Press CTRL+C to exit.")
try:
while True:
# p.ChangeDutyCycle(dc) # where 0.0 <= dc <= 100.0
time.sleep(1)
finally:
p.stop()
GPIO.cleanup()
if __name__ == '__main__':
main()
|
|