add gain=2, non-blocking operation, led abstracted

This commit is contained in:
2014-11-05 11:37:26 +01:00
parent c250106f08
commit d16530898e
6 changed files with 186 additions and 45 deletions

View File

@ -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;
}
}