Today we were introduced to the PicAXE 08M microcontroller. This first program I wrote was a basic one that would switch an LED on and off. After some tweaking of the program and taking advantage of the multiple outputs, I was able to have the PIC flash 3 LEDs. The picture shows the initial setup and code. There is a short video of the LEDs in action.
The next circuit for the day included a microswitch as an input to the PIC and 1 LED. When the button was pressed, the LED would light. In the circuit below, the switch was swapped for a light dependent resistor(LDR). The LDR shows a higher resistance with less light. The code for this circuit included 2 IF statements. If the LDR was in the light then the red LED was lit. If the LDR was in darkness, The green LED was lit. If the LDR was in the shade, not too dark or too light, neither LED would be lit. As you can see in the photos below, the first shows the LDR in the direct light.
In the next pictures, the LDR is half covered making both LED dark, and the last picture has the LDR completely covered making the green LED bright.






No comments:
Post a Comment