School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: main.cpp
- Revision:
- 9:fd1f07a4a0ff
- Parent:
- 8:1a1e7cf7dcb6
- Child:
- 10:137cf2c92871
--- a/main.cpp Thu Jan 14 12:41:37 2021 +0000 +++ b/main.cpp Thu Jan 14 14:07:01 2021 +0000 @@ -17,6 +17,7 @@ #include "mbed.h" AnalogIn light_sensor(A0); +AnalogIn rotary(A1); PwmOut led(D3); char building[31]; @@ -25,10 +26,12 @@ /// Used to test the controller and make sure that it functions /** DigitalOut myled(LED1); */ +#include "helper_functions.h" #include "setup_functions.h" #include "lcd_functions.h" #include "led_functions.h" -#include "helper_functions.h" +#include "rotary_functions.h" + int main(){ /* @@ -37,15 +40,45 @@ setup_run_setup();*/ float light_sensor_reading; + float rotary_reading; while(1) { + /** Code for testing that the rotary can control the LED light blinking + 1/14/2021 Working + */ + rotary_reading = rotary_reverse_read(rotary); + printf("%1.2f\n",rotary_reading); + led_set_blink_rate(rotary_reading); + wait_us(2000000); + + /** Code for testing if rotary has been turned or not + 1/14/2021 Working + */ + /** + if (rotary_is_on(rotary)) + { + printf("Rotary is on\n"); + } + else + { + printf("Rotary is off\n"); + } + wait_us(1000000); + */ + + /** Code for testing sensor readings + 1/14/2021 Working + */ + /** light_sensor_reading = light_sensor.read(); - printf("%1.2f\n", light_sensor_reading); - printf("%i%%\n", helper_get_sensor_read_in_percent(light_sensor_reading)); + rotary_reading = rotary.read(); + printf("Light intensity: %i%%\n", helper_get_sensor_read_in_percent(light_sensor_reading)); + printf("Rotary turned: %i%%\n", helper_get_sensor_read_in_percent(rotary_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.*/ + /** 1/13/2021 Used to test the controller and make sure that it functions.*/ /** printf("This is a test.\n"); myled = 1;