School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
rotary_functions.h
- Committer:
- tuxx0046
- Date:
- 2021-01-15
- Revision:
- 10:137cf2c92871
- Parent:
- 9:fd1f07a4a0ff
- Child:
- 14:3ac7c08dbc52
File content as of revision 10:137cf2c92871:
/** @file rotary_functions.h @author Tu Tri Huynh @date January 14, 2021 @brief Functions related to the Grove Rotary Angle Sensor */ /** Check if rotary has been turned. Returns true if rotary has been turned to a certain point (margin set). @rot AnalogIn rotary angle sensor object. 1/14/2021 */ bool rotary_is_on(AnalogIn rot) { if (rot.read() >= 0.04f) { return true; } return false; } /** Reverses the value of the analog rotary reading, which reads the resistance of the rotary so 0 becomes 1 and 1 becomes 0. The rotary increases in resistance as the rotary is turned, while the light sensor decreases its resistance as light intensity increases. The led_set_blink_rate() function is fitted to the light sensor read values and set to decrease blinking speed the higher the value. 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. @rot AnalogIn rotary angle sensor object. 1/14/2021 */ float rotary_reverse_read(AnalogIn rot) { return (1 - rot.read()); }