School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: main.cpp
- Revision:
- 6:aecab8e3acad
- Parent:
- 4:1a12157689a7
- Child:
- 7:b80c993f4db5
--- a/main.cpp Thu Jan 14 08:16:03 2021 +0000 +++ b/main.cpp Thu Jan 14 12:14:51 2021 +0000 @@ -1,36 +1,47 @@ /** @file main.cpp @brief Light Control System to automatically dimmer or increase light levels depending on registered light intensity. -Made for STM32F746G-DISCOVERY - +Made for: + STM32F746G-DISCOVERY + Grove Base Shield v2.1 + Grove Light Sensor v1.2 + Grove Rotary Angle Sensor v1.2 + Grove LED Socket Kit v1.5 + Grove LED diode + Grove Button v1.2 + @author Tu Tri Huynh - @date 1/13/2021 */ #include "mbed.h" -/// These are global variables and declared before most other things + +AnalogIn light_sensor(A0); +PwmOut led(D3); + char building[31]; char room[31]; /// Used to test the controller and make sure that it functions -DigitalOut myled(LED1); +/** DigitalOut myled(LED1); */ #include "setup_functions.h" #include "lcd_functions.h" - - +#include "led_functions.h" int main(){ /* - printf("Mbed OS version: %d,%d,%d\n\n",MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); - */ lcd_initialize(); lcd_show_setup_screen(); - setup_run_setup(); + setup_run_setup();*/ + + float light_sensor_reading; while(1) { - + light_sensor_reading = light_sensor.read(); + printf("%1.2f\n", light_sensor_reading); + led_set_blink_rate(light_sensor_reading); + wait_us(1000000); /** 01/13/2021 Used to test the controller and make sure that it functions.*/ /** @@ -41,4 +52,8 @@ wait_us(1000000); */ } + + /** + printf("Mbed OS version: %d,%d,%d\n\n",MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); + */ } \ No newline at end of file