简体   繁体   中英

Raspberry Pi send 3.3v signal for 100ms

I am working on a Image Classifier which will work on a RPi and after classifying the image from a camera it will need to send two 3.3v signals form two different GPIO pins for 100ms (based on the image classification).

How can I do this?

Thanks for your help and feel free to ask me more if needed.

import RPi.GPIO as GPIO
from time import sleep

led_pin = 17

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(led_pin, GPIO.OUT)

for _ in range(2):
    GPIO.output(led_pin, True)
    sleep(0.1)
    GPIO.output(led_pin, False)
    sleep(0.1)

Or setup more easily

from gpiozero import LED
from time import sleep

led = LED(17)

for _ in range(2):
    led.on()
    sleep(0.1)
    led.off()
    sleep(0.1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM