df robot to turn on rgb leds

userHead chris.garrison 2024-01-10 13:35:42 185 Views5 Replies

New here Looking for simple code to turn on rgb leds from a dfrobots v1.1 pir sensor

I have the pir sketch loaded and working.


2024-01-11 18:25:40

If you want to use pir module turn on the rgb module and have a rainbow effect, 


1.Read the rgb module's wiki first:


2.Install "Adafruit NeoPixel Library". 

  Download library:

  Install library method:


3.Download and run the code of rgb module rainbow effect controlled by the pir module :


userHeadPic Afra
2024-01-11 16:06:48

The sample code demonstrates the LED connection to digital pin13. It means the LED on the board will turn on if the pir on. If you plug another LED module on pin13,  the LED will work as well. (as the picture).


You also could connect the LED in different pin, just modify the pin number in the second line.




The relay module's wiki here:


Use the same method to connect the relay module, and upload the same code. 


userHeadPic Afra
2024-01-11 11:35:02

The pir sensor's tutorial and code here:


userHeadPic Afra
chris.garrison wrote:

thanks. this is what I used to load the sketch and the pir sensor is working properly. I need to know the code to turn on an led, rgb led, or relay. What is the code for that and where do I insert it? thanks Afra

2024-01-11 12:06:56
1 Replies
2024-01-10 13:38:58

DFRobote PIR sensor v 1.1

userHeadPic chris.garrison