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/05/08 13:38] 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=" | ||
Line 14: | Line 13: | ||
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
- | </ | + | </ |
- | </ | + | |
Return the raw <tooltip title=" | Return the raw <tooltip title=" | ||
Line 29: | 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 |
< | < | ||
Line 41: | Line 39: | ||
===Example #1=== | ===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: | + | 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 64: | 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=== | ===Example #2=== | ||
Line 92: | Line 90: | ||
[[uphp: | [[uphp: | ||
+ | |||
+ | [[pin_configure()]] - Configure an <tooltip title=" | ||
[[floatval()]] - < | [[floatval()]] - < | ||