CCT LED on two MOSFETS

Moderator: leecollings

Post Reply
TomaszSz7
Posts: 1
Joined: Friday 10 July 2020 1:59
Target OS: -
Domoticz version:
Contact:

CCT LED on two MOSFETS

Post by TomaszSz7 »

Hello guys!

I hope i will not duplicate the topic... i already scherach on forum but i can't find something similar.
I've already built a MOSFET based one LED stripe dimmer project. I used the script in Domoticz and everything works perfect.
Now i want to build something for CCT LED stripe and i have to say... i don't know how to do this.

Main requirement is that dimmer change the light intensity proportionally. I mean 50% warm LED and 50% cold LED and so on.
is it any chance to customize this code or i need to create another one ?
Do i have to create another user variable for additional GPIO ?

Thank you in advance :-)
best regards!
Tom

Code: Select all

commandArray = {}
DomDevice = 'LED1 '; 

IP = '192.168.0.104';
PIN = "2";
FED ='1000'

if devicechanged[DomDevice] then
   if(devicechanged[DomDevice]=='Off') then
		print ("OFF dim = "..uservariables['dimmer']);
		CalcValue = 0;
   	else if(devicechanged[DomDevice]=='On') then
   		DomValue = uservariables['dimmer'];
        print ("ON dim = "..uservariables['dimmer']);
        CalcValue = DomValue;
    else
    	print("Other");
        DomValue = otherdevices_svalues[DomDevice];
        CalcValue = math.floor(DomValue / 100 * 1023);
        commandArray['Variable:dimmer'] = tostring(CalcValue);
        print ("dim Level = "..uservariables['dimmer']);
   	end
   	end
   	runcommand = "curl 'http://" .. IP .. "/control?cmd=PWM,"  ..PIN.. "," .. CalcValue ..",".. FED .. "'";
   	os.execute(runcommand);
	print("PWM value= "..CalcValue);
end
return commandArray
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest