School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
rotary_functions.h
00001 /** 00002 @file rotary_functions.h 00003 @author Tu Tri Huynh 00004 @date January 14, 2021 00005 @brief Functions related to the Grove Rotary Angle Sensor 00006 */ 00007 00008 /** 00009 Check if rotary has been turned. Returns true if rotary has been turned to a certain point (margin set). 00010 @param rot AnalogIn rotary angle sensor object. 00011 1/14/2021 00012 */ 00013 bool rotary_is_on(AnalogIn rot) 00014 { 00015 if (rot.read() >= 0.04f) { 00016 return true; 00017 } 00018 return false; 00019 } 00020 00021 /** 00022 Reverses the value of the analog rotary reading, which reads the resistance of the rotary so 0 becomes 1 and 1 becomes 0. 00023 The rotary increases in resistance as the rotary is turned, while the light sensor decreases its resistance as light intensity increases. 00024 The led_set_blink_rate() function is fitted to the light sensor read values and set to decrease blinking speed the higher the value. 00025 This function can be used to reverse the value of the registered rotary resistance value so it can be used with the LED blinking function. 00026 @param rotary_value Rotary angle sensor read value. 00027 1/14/2021 00028 */ 00029 float rotary_reverse_read(float rotary_value) 00030 { 00031 return (1 - rotary_value); 00032 }
Generated on Fri Jul 15 2022 03:26:25 by 1.7.2