This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
uphp:functions:adc_read [2017/05/09 09:57] jeff |
uphp:functions:adc_read [2017/05/22 18:27] jeff |
||
---|---|---|---|
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 |
< | < | ||
Line 39: | 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 Wattmon releases, and has not yet been removed from the OS. The calibration constants are loaded automatically into [[uphp: |
<code php> | <code php> | ||
Line 62: | 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 90: | Line 90: | ||
[[uphp: | [[uphp: | ||
+ | |||
+ | [[pin_configure()]] - Configure an IO pin as a digital input, output, or analog input [for more information on Channel numbers which are also known as Pin Indexes] | ||
[[floatval()]] - < | [[floatval()]] - < | ||