Associate
- Joined
- 5 Apr 2008
- Posts
- 1,526
Hey guys,
Trying to learn embedded C.
I have a microcontroller (Microchip PIC18F4331) and have an LDR in the A/D converter pin.
Im trying to use interrupts and timers right now.
My task is to turn an LED off either at a certain light level or at a given time.
My question is about interrupts.. I understand how to use interrupt flags that are simple on or offs (like an interrupt at the press of a button)... but can an interrupt also be used for a certain light level being reached or would it have to be constantly checking the LDR light level in a while loop?
Trying to learn embedded C.
I have a microcontroller (Microchip PIC18F4331) and have an LDR in the A/D converter pin.
Im trying to use interrupts and timers right now.
My task is to turn an LED off either at a certain light level or at a given time.
My question is about interrupts.. I understand how to use interrupt flags that are simple on or offs (like an interrupt at the press of a button)... but can an interrupt also be used for a certain light level being reached or would it have to be constantly checking the LDR light level in a while loop?