Multiplication and Divide in Rules ESPeasy

Moderators: grovkillen, TD-er, Stuntteam

Post Reply
Message
Author
bypbop
Normal user
Posts: 2
Joined: 06 May 2020, 23:51

Multiplication and Divide in Rules ESPeasy

#1 Post by bypbop » 07 May 2020, 00:01

Hi Everyone,

I try to transform 0 to 255 in 0 to 1023 for RGB Ledstrip but it doesn't work. Can you tell me why ?

Code: Select all

on RGB do
PWM,05,%eventvalue1%*1023/255
PWM,12,%eventvalue2%*1023/255
PWM,13,%eventvalue3%*1023/255
endon
Regards,
Bypbop

TD-er
Core team member
Posts: 2644
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Multiplication and Divide in Rules ESPeasy

#2 Post by TD-er » 07 May 2020, 00:14

Why not just multiply by 4?

bypbop
Normal user
Posts: 2
Joined: 06 May 2020, 23:51

Re: Multiplication and Divide in Rules ESPeasy

#3 Post by bypbop » 07 May 2020, 00:34

It's ok i have understand how to do !

Code: Select all

on STOP do
PWM,05,0
PWM,12,0
PWM,13,0
endon

on RGB do
TaskValueSet,04,1,%eventvalue1%*1023/255
TaskValueSet,04,2,%eventvalue2%*1023/255
TaskValueSet,04,3,%eventvalue3%*1023/255


PWM,05,[RGB#Red]
PWM,12,[RGB#Green]
PWM,13,[RGB#Blue]
endon

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests