add gain=2, non-blocking operation, led abstracted
This commit is contained in:
@ -1,30 +1,36 @@
|
||||
#include "Arduino.h"
|
||||
|
||||
#include "Streaming.h"
|
||||
#include "Metro.h"
|
||||
|
||||
#include "ads1210.h"
|
||||
#include "led.h"
|
||||
|
||||
|
||||
const uint8_t LED_PIN = 8;
|
||||
const uint8_t ADC_CS_PIN = 9;
|
||||
const uint8_t ADC_RDY_PIN = 7;
|
||||
|
||||
|
||||
ADS1210 ads1210;
|
||||
|
||||
LED led;
|
||||
Metro secondTick = Metro(1000);
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
delay(1000);
|
||||
|
||||
pinMode(8, OUTPUT);
|
||||
|
||||
ads1210.begin(9, 7);
|
||||
|
||||
led(LED_PIN);
|
||||
ads1210.begin(ADC_CS_PIN, ADC_RDY_PIN);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
|
||||
delay(1000); // wait for a second
|
||||
ads1210.exec();
|
||||
|
||||
if (secondTick.check() == 1) {
|
||||
led.toggle();
|
||||
|
||||
uint32_t adcValue = ads1210.get();
|
||||
Serial << "AdcValue: " << adcValue << endl;
|
||||
Serial << "AdcValue: " << adc1210.value << endl;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user