Ajout du dossier de test (fourre-tout) contenant différent codes de test
This commit is contained in:
		
							parent
							
								
									a79db84f16
								
							
						
					
					
						commit
						7381d6d6e1
					
				
							
								
								
									
										34
									
								
								test/TestLibAdc/TestLibAdc.ino
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								test/TestLibAdc/TestLibAdc.ino
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
#include "Ads1115V2.h"
 | 
			
		||||
 | 
			
		||||
AdcSetting adcSetting(3300.0, 15, 1, 10);
 | 
			
		||||
Ads1115V2 adc;
 | 
			
		||||
 | 
			
		||||
uint8_t channel(0);
 | 
			
		||||
 | 
			
		||||
void setup() {
 | 
			
		||||
  // put your setup code here, to run once:
 | 
			
		||||
  Serial.begin(115200);
 | 
			
		||||
  delay(1000);
 | 
			
		||||
  Serial.println("Start setup");
 | 
			
		||||
  adc.begin();
 | 
			
		||||
  adc.setAdcSetting(adcSetting);
 | 
			
		||||
  //measureUnit.setGlobalTempOffset(-17);
 | 
			
		||||
  Serial.println("End setup");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void loop() {
 | 
			
		||||
  // put your main code here, to run repeatedly:
 | 
			
		||||
  adc.startSample(channel);
 | 
			
		||||
 | 
			
		||||
  if(adc.isSampleReady())
 | 
			
		||||
  {
 | 
			
		||||
    Serial.print("Sample is ready : ");Serial.println(channel);
 | 
			
		||||
    double raw = adc.getSampleValue();
 | 
			
		||||
    Serial.print("Value : ");Serial.println(raw,4);
 | 
			
		||||
    Serial.print("Voltage : ");Serial.println(raw * adc.getQuantum());
 | 
			
		||||
    Serial.println();
 | 
			
		||||
 | 
			
		||||
    channel++;
 | 
			
		||||
    channel %= 8;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user