-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- fix #82, minimal timeout 10 ms for RTOS, kudos to deKees687 - set error flag for TIMEOUT - add error codes to keywords.txt
- Loading branch information
1 parent
760f89f
commit 320f17e
Showing
8 changed files
with
121 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// FILE: ADS_read_getError.ino | ||
// AUTHOR: Rob.Tillaart | ||
// PURPOSE: read analog inputs and check for error. | ||
// URL: https://github.com/RobTillaart/ADS1X15 | ||
|
||
// test | ||
// connect 1 potmeter per port. | ||
// | ||
// GND ---[ x ]------ 5V | ||
// | | ||
// | ||
// measure at x (connect to AIN0). | ||
|
||
|
||
#include "ADS1X15.h" | ||
|
||
ADS1115 ADS(0x48); | ||
|
||
int16_t value[4]; | ||
int err = ADS1X15_OK; | ||
float voltageFactor = 1; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(); | ||
Serial.println(__FILE__); | ||
Serial.print("ADS1X15_LIB_VERSION: "); | ||
Serial.println(ADS1X15_LIB_VERSION); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ADS.begin(); | ||
|
||
voltageFactor = ADS.toVoltage(1); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
ADS.setGain(0); | ||
|
||
float f = ADS.toVoltage(1); // voltage factor | ||
|
||
for (int channel = 0; channel < 4; channel++) | ||
{ | ||
value[channel] = ADS.readADC(channel); | ||
err = ADS.getError(); | ||
if (err != ADS1X15_OK) | ||
{ | ||
Serial.print(channel); | ||
Serial.print(" returns error: "); | ||
Serial.println(err); | ||
} | ||
|
||
Serial.print("\tChannel "); | ||
Serial.print(channel); | ||
Serial.print(": "); | ||
Serial.print(value[channel]); | ||
Serial.print('\t'); | ||
Serial.println(value[channel] * voltageFactor, 3); | ||
} | ||
|
||
// optional do other things with value[channel] | ||
|
||
delay(1000); | ||
} | ||
|
||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=ADS1X15 | ||
version=0.5.0 | ||
version=0.5.1 | ||
author=Rob Tillaart <[email protected]> | ||
maintainer=Rob Tillaart <[email protected]> | ||
sentence=Arduino library for ADS1015 - I2C 12 bit ADC and ADS1115 I2C 16 bit ADC | ||
|