My previous project (grove LED bar) still does not work, problems with I2C grove LED bar v2.0. So I decided to do much simpler: connecting a single LED to the grove port A1 and 'talking' analogously would prove the ability to connect and talk to my first grove device. Slightly reduce the potentiometer protecting the LED, and it works!
You might think, this is the most useless project, since the Calliope is equipped with 25 red LEDs and a nice RGB LED, so why connect another external LED? Just testing the ports and the code.
ArraysA little bit embarrassing is the fact, that the block-programming offered by pxt.calliope.cc does not (yet) offer the data type of arrays, no sine, log or exp function either. This is why I went over, to edit in the JavaScript window the necessary arrays, which replace the values of the sine function.
Weber–Fechner lawA nice thing to see here anyway, how the human eye perception works. As an example, let's place one candle in a dark room and you start recognizing things - not really ready for reading! Now, is the perception of two candles in the room double the intensity of one single candle? Actually no! It would take about ten candles to have the impression of double the light intensity.
With this observation in mind, it would not fit our perception to vary light intensity in a linear way from 0 to 1023 values, but we need a bent curve instead - what kind of bending is a matter of further enquiries.
Comparing the curves of Fig.1 with the perception curve of the German Wiki Weber-Fechner Gesetz, you notice a flipped shape. Keep in mind, we are looking for the energy increment necessary to give a smoothly increasing perception to the human eye.
In this project, I fully ignore the fact of rather changing a LED's intensity by pulse-width modulation (PWM). Needs some more work, to be precise.
References
Comments