Advertisement
hwthinker

ADS1115

Mar 21st, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. #include <Adafruit_ADS1015.h>
  3. Adafruit_ADS1115 ads(0x48);
  4. float Voltage = 0.0;
  5. void setup(void){
  6.   Serial.begin(9600);
  7.   ads.begin();
  8. }
  9.  
  10. void loop(void){
  11.   int16_t adc0;
  12.   adc0=ads.readADC_SingleEnded(0);
  13.   Voltage = (adc0 * 0.1875) /1000;
  14.   Serial.print(" AIN0:");
  15.   Serial.print(adc0);  
  16.  
  17.   Serial.print(" Voltage: ");
  18.   Serial.print( Voltage,3);
  19.   Serial.print(" V \n\r");
  20.  
  21.   delay(700);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement