I can control its brightness but I can't go under 0.48V and upper to 2.18V on CX =/
I manage to make a PWM to toggle the light on/off smoothly
Source Code:
-- PWM system by Levak 2011
time.start(0.01)
i=1 d=1 w=20
function on.create() time.start(0.01) end
function on.paint(gc)
gc:drawString("luminosity : "..(i/w*100).."%", 0, 0, "top")
gc:drawString("step (up/down: "..math.abs(d), 0, 20, "top")
gc:drawString("width (+/-): "..w, 0, 40, "top")
end
function on.timer()
print(string.rep(string.rep("\001", i)..string.rep("\127", w-i), 100))
if i < 1 or i > w then d = -d end
i = i + d
platform.window:invalidate()
end
function on.arrowKey(key)
if key == "down" then d = d - (d < 0 and -1 or 1)
elseif key == "up" then d = d + (d < 0 and -1 or 1)
end
platform.window:invalidate()
end
function on.charIn(ch)
if ch == "+" then w = w + 1
elseif ch == "-" then w = w - 1
end
platform.window:invalidate()
end