Search code examples
shellraspberry-pigpio

Control led that connected to GPIO via shell


I'm using Asus Tinker board and trying to use GPIO to control leds. I'm very limmeted in what I can install so I'm using shell commends to do this.

like this:

  echo 223 > /sys/class/gpio/export 
  echo out > /sys/class/gpio/gpio223/direction 
  echo 1 > /sys/class/gpio/gpio223/value 

It's working fine but what I'm struggle to find is how can I proferm fade in/out (Breathing effect)

and I'm must stick to shell commands. so no Python or C


Solution

  • you need to implement PWM. In short: switching LED on and off very quickly and changing proportion of time when LED is on and off.

    You can probably reach desired Breathing effect, but it's very CPU consuming. There are packages like gpio using hw timers, but installation is needed.