RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Flash effect for few buttons (Raspi, GPIOs, LED ...)

    Scheduled Pinned Locked Moved Projects and Themes
    gpioflash effecteye catcher
    2 Posts 2 Posters 167 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • top-specciT
      top-specci
      last edited by

      Hi,
      now I (we) have time :-(

      I just add first LED flash effect for the "COIN" button on my arcade station, so the flash intervall is changing (slow, fast, faster, fast, slow, ...). Normally the LED is simple "ON". Now it's a litte eye catcher ;-)

      For this is just connect the LED from one button (COIN) to one of the Raspi GPIO's (LED use only 20mA), and a simple python script run in a endless loop to create the flash effect.

      Maybe someone else already have a "nice" python flash effects programmed to control LED(s) from a Arcade-Station, maybe with more than only one LED ?
      My idea is to use also the P1 and the P2 button, so at the end I have three LED's to make some interesting "flash effects".
      Is there any code I can use and modify if I need/want ?

      I will past my simple (and dirty) Python code here also:

      import RPi.GPIO as GPIO
      import time
      GPIO.setmode(GPIO.BCM)
      
      GpioNumber=19
      GPIO.setup(GpioNumber, GPIO.OUT)
      
      while True:
         for a in range(1,22):
            GPIO.output(GpioNumber, GPIO.HIGH)
            tms=a*50
            t=((1100-tms)/1000.0)
            time.sleep (t)
            GPIO.output(GpioNumber, GPIO.LOW)
            time.sleep (0.25)
      
         for a in range (1,25):
            GPIO.output(GpioNumber, GPIO.HIGH)
            time.sleep (0.045)
            GPIO.output(GpioNumber, GPIO.LOW)
            time.sleep (0.025)
      
         for a in range(1,22):
            GPIO.output(GpioNumber, GPIO.HIGH)
            tms=a*50
            t=((tms)/1000.0)
            time.sleep (t)
            GPIO.output(GpioNumber, GPIO.LOW)
            time.sleep (0.25)
      
         GPIO.output(GpioNumber, GPIO.HIGH)
         time.sleep (3)
         GPIO.output(GpioNumber, GPIO.LOW)
         time.sleep (0.25)
      
      1 Reply Last reply Reply Quote 0
      • L
        losernator
        last edited by

        It's not python code but.. maybe could be useful for you.

        While ago - Using gpio and PWM - I did add some flash effects to every buttons on my bartop build.

        check out this video

        and you can find source code here.
        https://github.com/losernator/rainbowLED

        FYI My friend 'sana2dang' made original code for me and I just add little bit.
        Although I am not using this any more and moved to RGB effect using Aruino :) but worth trying

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

        Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.