The problem is that I need to simulate a press once instead of continous, to overcome strange behaviour.
Therefore I need a maximum trigger of 200 milliseconds approximately.
Is this possible with a Pi and what do I need to do?
I have tried it with python
Code: Select all
pi@raspberrypi:~ $ cat GPIO-test.py
import RPi.GPIO as GPIO # import RPi.GPIO module
from time import sleep # lets us have a delay
GPIO.setmode(GPIO.BCM) # choose BCM or BOARD
GPIO.setup(17, GPIO.OUT) # set GPIO17 as an output
GPIO.output(17, 1) # set GPIO17 to 1/GPIO.HIGH/True
sleep(0.2) # wait half a second
GPIO.output(17, 0) # set GPIO17 to 0/GPIO.LOW/False
Code: Select all
pi@raspberrypi:~ $ cat GPIO-testv3.py
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
led = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(led, GPIO.OUT)
endtime=time.time()+0.2 #200 milliseconds
GPIO.output(led, 0)
while (time.time()<endtime):
GPIO.output(led, 1)
GPIO.output(led, 0)
I can do a switchoff after the amount of milliseconds (like this example: GPIOx.switchOff().afterSec(0.250) ), but am not able to turn it on for the right amount of time.