GPIO Output Help

I noticed that we have GPIO: Output () support as well Servo. I’m having some trouble wrapping my head around how output’s get’s implemented. Does anyone have a high level overview of what is needed?

For a common example, let’s say lighting up an LED based on a certain RPM as if you were creating a shift light.

Make a trigger with trigger condition RPM > 4000 and attach a Action ‘Set value on trigger status’ with GPIO Output as a set value.

Thank you! That was exactly what I needed to get started with understanding how to implement the triggers with GPIO. This worked perfectly. Basic summary, an action of “set value on trigger” will change 0 (low) to 1 (high) on the pin.

I played with the GPIO Servo and it worked well when setting an action value of 90 (moved to 90 degrees)
A) I did notice that it jittered a lot (May need to add ChangeDutyCycle(0) to the backend code to stop the sensor searching?)
B) the reset condition did not set the servo back to 0. A second trigger had to be setup with a value of 0.
C) For my LED test, I noticed if the action is 1 and you shutdown RD before the reset condition, the LED will stay on. May need to add a GPIO.cleanup() to the background code on shutdown. I see there is a trigger option for App shutdown but I couldn’t get it to work.

To play with this some more, I decided to create a python script running in the background that was listening on the GPIO: Output (Pin N). I’ll include the test script here and how I set it up for anyone that want’s to play with this feature.

  1. Create a trigger
  2. Trigger condition > if “RPM” is greater than 6000
  3. Actions > New Action
    3a) Action Type: set value on trigger
    3b) Select Input: GPIO: Servo(Pin 18)
  4. Reset conditions > if “RPM” is less than or equal to 6000

Basic Python script how to:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

GPIO.setup(16, GPIO.OUT) #led or servo
GPIO.setup(18, GPIO.IN) #This is the input signal from RealDash

try:
    while true:
        if GPIO.input(18) == 1: 
            <your code>
finally:
    GPIO.cleanup()

I was able to play around enough to make a full script of what I want it to do. Can’t wait to finish the physical portion and show it off!

1 Like

Happy to hear you are making progress.

A. Will check this. This may be servo dependent too.

B. You need to have reset condition in your trigger too. So set your trigger:
Trigger Condition: RPM > 5000, Reset Condition: RPM < 5000. Then the ‘Set to trigger status’ action works properly.

C. This has been intentional to leave certain states on even when RealDash is closed. We may need an option to reset everything on close.

Finally getting some light :ok_hand:t5: