right now , i am doing C programming for my board.
the task is write a code of " XYZ sensor that tilt either way, the program must let the LED light up , and it will tilt back to be constant."
please help .
thanks alot.
I find analog easier to write for. In a loop, start ADC and get a sample of each XYZ. IF statement to compare sample to greater / less than constant number threshold which turns on LED, ELSE turns off LED.
If you just want to operate LED with accordance to Sensor.
then Just use Opam and a Transistor to generate low and high signals.
Then you can connect the output of the Transistor to the Interrupt pin and program accordingly.
or
U can use polling method to check the status of the sensor output on the PIN.
By using microcontroller with small C coding you can read than analog voltage through internal ADC of microcontroller and then compare that analog value to your C program constant value to Turn ON or OFF the LED.