-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add **autoMidPointDC(cycles)** see issue #35 - add rounding to **autoMidPoint()** - update README.md
- Loading branch information
1 parent
2a6eaee
commit d7beb2d
Showing
9 changed files
with
113 additions
and
18 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,54 @@ | ||
// | ||
// FILE: ACS712_autoMidPointDC.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: demo detect DC midpoint. | ||
// URL: https://github.com/RobTillaart/ACS712 | ||
|
||
|
||
#include "ACS712.h" | ||
|
||
|
||
// Arduino UNO has 5.0 volt with a max ADC value of 1023 steps | ||
// ACS712 5A uses 185 mV per A | ||
// ACS712 20A uses 100 mV per A | ||
// ACS712 30A uses 66 mV per A | ||
ACS712 ACS(A0, 5.0, 1023, 100); | ||
// ESP 32 example (might requires resistors to step down the logic voltage) | ||
// ACS712 ACS(25, 3.3, 4095, 185); | ||
|
||
|
||
uint32_t start, stop; | ||
|
||
uint16_t midPoint = 0; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
while (!Serial); | ||
Serial.println(__FILE__); | ||
Serial.print("ACS712_LIB_VERSION: "); | ||
Serial.println(ACS712_LIB_VERSION); | ||
delay(10); | ||
|
||
// might be different 1 cycle or 100. | ||
start = micros(); | ||
midPoint = ACS.autoMidPointDC(1); | ||
stop = micros(); | ||
Serial.println("ACS.autoMidPointDC()"); | ||
Serial.print("us:\t"); | ||
Serial.println(stop - start); | ||
Serial.print("MP 1:\t"); | ||
Serial.println(midPoint); | ||
|
||
midPoint = ACS.autoMidPointDC(100); | ||
Serial.print("MP 100:\t"); | ||
Serial.println(midPoint); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
} | ||
|
||
|
||
// -- 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=ACS712 | ||
version=0.3.5 | ||
version=0.3.6 | ||
author=Rob Tillaart <[email protected]>, Pete Thompson <[email protected]> | ||
maintainer=Rob Tillaart <[email protected]> | ||
sentence=ACS712 library for Arduino. | ||
|
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 |
---|---|---|
|
@@ -212,4 +212,4 @@ unittest(test_AmperePerStep) | |
unittest_main() | ||
|
||
|
||
// -- END OF FILE -- | ||
// -- END OF FILE -- |