This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:adc_read [2017/04/04 10:44] jeff |
uphp:functions:adc_read [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 7: | Line 7: | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | <well size=" |
- | <span style=" | + | <span style=" |
- | < | + | <span style=" |
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
Line 27: | Line 27: | ||
Channel 2 is connected to pin A3, which reads 0-5V DC. | Channel 2 is connected to pin A3, which reads 0-5V DC. | ||
- | ====Return | + | ====Return |
- | <badge>WMPRO</badge> ADC value (10-bit), 0-1023 | + | <html>< |
- | < | + | < |
+ | |||
+ | < | ||
====Examples==== | ====Examples==== | ||
- | **Example #1** - Read Channel 0 and use the constants v_adc_offset and v_adc_mul to obtain a calibrated voltage((**Example #1** demonstrates a legacy method to obtain a calibrated voltage, which was the primary method in early Wattmon releases, and has not yet been removed from the OS. The calibration constants are loaded automatically into [[uphp: | + | ===Example #1=== |
+ | |||
+ | Read Channel 0 and use the constants v_adc_offset and v_adc_mul to obtain a calibrated voltage((**Example #1** demonstrates a legacy method to obtain a calibrated voltage, which was the primary method in early [[hardware: | ||
<code php> | <code php> | ||
Line 58: | Line 62: | ||
====Additional Information==== | ====Additional Information==== | ||
- | The raw ADC values can be accessed using [[adc_read()]], | + | The raw ADC values can be accessed using [[adc_read()]], |
- | **Example #2** - Use [[mb_get_dev_by_id()]] to obtain calibrated values for A1, A2 and A3: | + | ===Example #2=== |
+ | |||
+ | Use [[mb_get_dev_by_id()]] to obtain calibrated values for A1, A2 and A3: | ||
<code php> | <code php> | ||
Line 85: | Line 91: | ||
[[uphp: | [[uphp: | ||
- | [[floatval()]] - Return the floating point value of a number or string | + | [[pin_configure()]] - Configure an <tooltip title=" |
+ | |||
+ | [[floatval()]] - < | ||