microsoft / pxt-chibitronics

Chibitronics Love To Code board editor with Microsoft MakeCode
https://makecode.chibitronics.com
Other
23 stars 15 forks source link

Map dimmer brightness to the RGB led brightness #84

Closed samelhusseini closed 6 years ago

samelhusseini commented 6 years ago

"Feedback from Jie's workshop at Columbia Teacher's College":

  1. there was not an obvious change in brightness in values between 50 and 100 (it looked pretty much on). Is it possible to map dimmer brightnesses to take up more of the spectrum?
samelhusseini commented 6 years ago

I've increased the blur of the neopixel, and added a transform scale that makes it bigger the brighter it is, hopefully these two will make it more obvious the differences between brightnesses.

samelhusseini commented 6 years ago

@jieq let me know what you think of the latest mapping

jieq commented 6 years ago

Ah, apologies for the confusion! By "brightness" I was referring to the analog PWM value for the "set [a0] to (value)" block, not the brightness block for RGB LEDs. When I set an analog pin to values between ~25 and 100, they appear to be the same brightness.

I also tried brightness for RGB and the difference in brightness is pretty clear, so that looks great!

samelhusseini commented 6 years ago

Here we go:

maplightbrightness

jieq commented 6 years ago

Hey! Thanks for updating the animation. However, when we actually go to program the LTC with our "set [a0] to [brightness]" blocks, we still see that between the values of ~25 to 100, the brightness of the onboard LED and any attached paper circuit LEDs are the same visible brightness. However, when we program using ltc.chibitronics.com with setLevel(0, 25) and setLevel(0, 100), we see a clear difference in brightness of the onboard. There appears to be some difference in how the values are mapped to PWM output on the board. Could we please correct the visible brightnesses so that there is more variation in brightness across the scale (e.g. better matches the resulting brightness from the LTC text-based editor)?

samelhusseini commented 6 years ago

Ah. Sounds like a bug in the API, I'll look into that. Haha we're getting all these crazy animations on the simulator in the process of figuring out this bug.

samelhusseini commented 6 years ago

Figured it out. analogWrite in ltc-os is expecting a value between 0 and 255, whereas we were assuming value ranges were betweein 0 and 1023 which is what micro:bit uses. fixing