Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
351 | f9daq | 1 | #include <Wire.h> |
2 | #include <Adafruit_ADS1015.h> |
||
3 | |||
4 | Adafruit_ADS1115 ads(0x48); |
||
5 | float Voltage = 0.0; |
||
6 | |||
7 | void setup(void) |
||
8 | { |
||
9 | Serial.begin(115200); |
||
10 | ads.begin(); |
||
11 | } |
||
12 | |||
13 | void loop(void) |
||
14 | { |
||
15 | int16_t adc0; // we read from the ADC, we have a sixteen bit integer as a result |
||
16 | |||
17 | adc0 = ads.readADC_SingleEnded(0); |
||
18 | |||
19 | float factor = (9.5/3.3); |
||
20 | Voltage = (adc0 * 0.1875)/1000*factor; |
||
21 | |||
22 | |||
23 | |||
24 | |||
25 | Serial.println(Voltage, 7); |
||
26 | |||
27 | delay(200); |
||
28 | } |