-
assignment
- connect an input device to an output device.
-
light sensor & output
-
I added a phototransistor to the sample board that controlled an RGB LED, and used the phototransistor to control the light's output. I worked with cad.py to modify the hello.RGB.45.cad circuit to include the phototransistor -- I had to move the blue LED pin from PB2 to another pin so that I could have access to one of the ADC pins for the photo transistor. This is reflected in the new cad file, sensitive-light.cad, which is pictured below:
I'll put this up after class.
I also worked with the sample code for controlling the RGB LED and reading output from the phototransistor. Working with the hello.RGB.45.asm as a base, I modified the main loop of the code to check if the light value is above a certain threshhold, and turn off the light if it is. Otherwise, the light is on and cycles through colors as in the RGB example. I would have liked to scale to interpolate the output between two colors -- say red if it was really dark, blue if it was really light, and purple for somewhere in the middle -- but sadly time did not allow. My modified version of the source code can be found in sensitive-light.asm.
This is the completed board I'll demo in class:
-