Week 2 – IPC
Lab & Messing Around:
The original code allowed the turning knob to change the brightness of one LED and for the pressure gauge to change the brightness of one LED. Having a CS background, I wanted to tinker with the code. I made the turning knob to change the brightness of three LED’s. As the knob turned from left to right, the left LED would get dimmer while the center LED would get brighter. As the knob kept going right, the left LED would completely turn off, while the center LED would start to dim and the right LED would get brighter. The same action applied turning the knob right to left.
Note:
It is always best to read the full assignment before delving into the coding aspect. I spent over an hour trying to write the perfect mapping function since I wanted the raw data to represent different brightness, depending if the knob was at either 9, 12, or 3 o’clock. After coding and trying to conjure up the right mathematical formulas and having unacceptable results, I did some more reading. Found out that Processing provides their own mapping function. It’s good to be gun-ho about your studies, but make sure you do some reading / research before starting. It will save you time & emotions in the long run.




One Comment
tru
It always hurts to find out the code is already written…
But nice going at it anyhoo…
And aren-t fsr’s so nice?
Tom Gerhardt
9/26/2010
Leave a Reply