mirror of
https://github.com/workinghard/LTC4622G.git
synced 2025-12-13 15:02:10 +00:00
A popular library installation technique is to download the library via GitHub's Clone or download > Download ZIP and then use the Arduino IDE's Sketch > Include Library > Add .ZIP Library on the downloaded file. This requires the library to be in the root of the repository, not in a subfolder. If the library is not in the root of the repository this installation technique fails: Specified folder/zip file does not contain a valid library This is the standard repository structure used in all official Arduino libraries: https://github.com/arduino-libraries This move is also required if you wanted to add your library to the Arduino Library Manager index, which provides an even easier installation option.
32 lines
527 B
C++
32 lines
527 B
C++
#include "Arduino.h"
|
|
#include <LTC4622G.h>
|
|
|
|
LTC4622G myDisplay = LTC4622G();
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
}
|
|
|
|
unsigned long lastChanged=0;
|
|
int value=0;
|
|
float vout=0.0;
|
|
|
|
void loop() {
|
|
unsigned long now = millis();
|
|
|
|
// Keep the display uptodate
|
|
myDisplay.update();
|
|
|
|
// read ADC
|
|
value = analogRead(A0);
|
|
// Calculate
|
|
vout = (value * 5.0) / 1024.0; // see text
|
|
|
|
// Change not too fast
|
|
if ( now - lastChanged > 200 ) {
|
|
myDisplay.setValue(vout);
|
|
lastChanged = now;
|
|
}
|
|
|
|
}
|