# RGB LED module script



## Phishfry (Oct 30, 2022)

I am testing a 3 color LED module KY-016 commomly found in Arduino Sensor packages.





						Amazon.com: 3 Pack KY-016 Three Colors RGB LED Sensor Module for Arduino DIY Starter Kit : Industrial & Scientific
					

Buy 3 Pack KY-016 Three Colors RGB LED Sensor Module for Arduino DIY Starter Kit: Proximity Sensors - Amazon.com ✓ FREE DELIVERY possible on eligible purchases



					www.amazon.com
				




I would like to see anyones scripts for GPIO LED's.

I am using 3 GPIO Pins on RockPro64 for 6 colors. Header Pin 11,13,15 and Pin 9 for ground.

Hear is my script rgb.sh:

```
#!/bin/sh
####### FreeBSD RGB LED Display Script ######
#
#### Assign board pin variables ####
redPinbus="/dev/gpioc1"
redPin="22"
greenPinbus="/dev/gpioc1"
greenPin="18"
bluePinbus="/dev/gpioc1"
bluePin="1"
#
#### Initialize the pins as an outputs ####
gpioctl -f ${redPinbus} -c ${redPin} OUT
gpioctl -f ${greenPinbus} -c ${greenPin} OUT
gpioctl -f ${bluePinbus} -c ${bluePin} OUT
gpioctl -f ${redPinbus} -p ${redPin} 0
gpioctl -f ${greenPinbus} -p ${greenPin} 0
gpioctl -f ${bluePinbus} -p ${bluePin} 0
#
#### The 6 color Loop ####
#### Red, Green, Blue, Green Blue, Green Red, Blue Red ####
while true
do
gpioctl -f ${redPinbus} -p ${redPin} 1
sleep 2
gpioctl -f ${redPinbus} -p ${redPin} 0
gpioctl -f ${greenPinbus} -p ${greenPin} 1
sleep 2
gpioctl -f ${greenPinbus} -p ${greenPin} 0
gpioctl -f ${bluePinbus} -p ${bluePin} 1
sleep 2
gpioctl -f ${greenPinbus} -p ${greenPin} 1
sleep 2
gpioctl -f ${bluePinbus} -p ${bluePin} 0
gpioctl -f ${redPinbus} -p ${redPin} 1
sleep 2
gpioctl -f ${greenPinbus} -p ${greenPin} 0
gpioctl -f ${bluePinbus} -p ${bluePin} 1
sleep 2
gpioctl -f ${redPinbus} -p ${redPin} 0
gpioctl -f ${bluePinbus} -p ${bluePin} 0
sleep 2
done
```


----------

