Using rules to dim led strip ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sibianul
Normal user
Posts: 28
Joined: 28 Jun 2017, 11:53

Using rules to dim led strip ?

#1 Post by sibianul » 28 Apr 2018, 09:23

Hello everyone,

I use EasyESP in my office for quite some time now, I think it's been 2 years already, I was switching ON and OFF 2 x 5m led strips and now it's time for an upgrade :)

First I want to have a soft-start (dim leds from OFF to FULLY ON) and also soft-stop (dim leds from ON to OFF). I have my hardware ready on an breadboard, will make an small PCB but I'm curios regarding the software side, for no I just made a simple code to DIM leds ON and OFF in a loop but I'm curious if I can still use EasyESP, wondering if using rules I can make something like this :

Code: Select all

if pin changed state
{
	if pin == 1
	{
		// DIM LEDS ON
		for x = 0; x < 255; x++
			analogWrite(pwm pin, x )
	}
	
	if pin == 0
	{
		// DIM LEDS OFF
		for x = 255; x > -1; x--
			analogWrite(pwm pin, x )
	}
}
I wanted to use the same code as before in my main controller, where the informations are centralized and where the commands to each device are sent from, so when my controller is switching (to 1) PIN x on the EasyESP device (right now on that pin I have an relay module) I want to generate an PWM signal on PIN y (from 0 to 255), than when the controller is switching PIN x to 0, the PWM signal on PIN y should go down from 255 to 0. Is it possible ?

After I will make the dim function, I want to mount a few PIR sensors to automate the ON and OFF proccess.

Thank you.
Attachments
dashboard.jpg
dashboard.jpg (203.46 KiB) Viewed 2126 times

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: Using rules to dim led strip ?

#2 Post by wim16 » 28 Apr 2018, 14:38

You can add a duration to the pwm command in EspEasy to make it fade in or out. See the wiki.

Post Reply

Who is online

Users browsing this forum: No registered users and 57 guests