controling a RGB Led
LEDboy
Posts: 21
I need some help I've been playing around with the FullDuplexSerialPlus program and a RGB Led. What I'm trying to do is us the FullDuplexSerialPlus as an input for the duty cycle of the RGB.· I would like·to be able to ajust the brightness 0 -255 of the 3 colors in order to make diffrent colors...can someone point me in the right direction. It cant be as hard as I'm making it. hahaha·
Comments
the FDS+-onject provides a method
with this you could receive a string containing a character "R" , "G", "B" for indicating the channel and a value
example: "B128"
and then use the StrToDec-method to change the string "128" into the integernumber 128
the string has to be ZERO-terminated when using FDS+
if you use the extended_FDSerial-object (ExFDS) there is a version where strings can be terminated with a carriage return or
a self defined delimiter
then in in the obex there is a PWM-object
Dedicated pwm generator
with a small demoprogram for that.
attention in the CON-section of the PWM-demo you have to change the
best regards
Stefan
A COG using both counters would not be enough as well. But I believe for this usecase it would be feasible to do the PWM in software. Doing a 16 bit PWM @ some kHz should be doable.