![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Light Control System using Grove Light Sensor and Grove Rotary Angle Sensor to control an LED light.
Dependencies: BSP_DISCO_F746NG
Revision 7:3f2c95c3bba0, committed 2021-01-08
- Comitter:
- tuxx0046
- Date:
- Fri Jan 08 13:07:11 2021 +0000
- Parent:
- 6:f2b6630d3612
- Commit message:
- Small fixes.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
sensor_light_control.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f2b6630d3612 -r 3f2c95c3bba0 main.cpp --- a/main.cpp Fri Jan 08 11:45:44 2021 +0000 +++ b/main.cpp Fri Jan 08 13:07:11 2021 +0000 @@ -1,5 +1,7 @@ /* -Made by Tu Tri Huynh. January 7, 2021 +Made by Tu Tri Huynh. +January 7, 2021 - Rotary and light sensor functionality created +January 8, 2021 - Basic LCD output functionality created. Small fixes made. Description: Light sensor that will turn on a LED light depending on how light/dark it is @@ -18,7 +20,7 @@ char light_to_lcd[30]; // char array for light sensor LCD text output char rotary_to_lcd[30]; // char array for rotary sensor LCD text output float light_level = 0.00f; // how much light is registered - float rotary_turnlevel = 0.00f; // how many percent the rotary + float rotary_turnlevel = 0.00f; // how many percent the rotary has been turned lcd_initialize(); lcd_show_startup_screen();
diff -r f2b6630d3612 -r 3f2c95c3bba0 sensor_light_control.h --- a/sensor_light_control.h Fri Jan 08 11:45:44 2021 +0000 +++ b/sensor_light_control.h Fri Jan 08 13:07:11 2021 +0000 @@ -3,10 +3,10 @@ This file contains code for controlling the blinking/brightness using light and rotary sensors. -The AnalogIn API reads the voltage as a fraction of the system voltage. +"The AnalogIn API reads the voltage as a fraction of the system voltage. The value is a floating point from 0.0(VSS) to 1.0(VCC). -For example, if you have a 3.3V system and the applied voltage is 1.65V, then AnalogIn() reads 0.5 as the value. -Further reading: https://os.mbed.com/docs/mbed-os/v6.6/apis/i-o-apis.html +For example, if you have a 3.3V system and the applied voltage is 1.65V, then AnalogIn() reads 0.5 as the value." +Above quote from: https://os.mbed.com/docs/mbed-os/v6.6/apis/i-o-apis.html I'm using the above information to read the light sensor and rotary values, as they are analog input devices. */ @@ -101,7 +101,7 @@ } // If rotary is in position zero (e.g. not turned), let the light sensor control light else { - // Light + // Light sensor control activation control_light_sensor(); } }