-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDAQAnalogSweep.ino
54 lines (42 loc) · 1.41 KB
/
DAQAnalogSweep.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* Name: DAQAnalogSweep
* Author: Matthew Miller
* Updates by Isaac Rowe
* Description: Reads DAQ analog values and prints them on a Character LCD
* where row 1 prints the analog channel and row 2 prints the analog value of that channel
*
*/
#include <LiquidCrystal.h>
#include <ExtendedADCShield.h>
#include <SPI.h>
//Initialize the ADC Shield with default pins and 16-bit ADC (LTC1859)
ExtendedADCShield extendedADCShield(16);
float ch0;
// change this number to the number of channels being sampled on the daq.
const int numDAQChan = 8;
// initialize the library with the required LCD interfaced pins.
const int rs = 24, en = 25, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
//initial sensor Value
int sensorValue = 0;
float sensorFloat = 0;
String sensorString;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
SPI.begin();
lcd.begin(16,2);
extendedADCShield.analogReadConfigNext(0, SINGLE_ENDED, BIPOLAR, RANGE10V);
}
void loop() {
// put your main code here, to run repeatedly:
for(int i = 0; i < numDAQChan; i++){
//sensorValue = analogRead(i+14); //Analog channels start at pin 14
sensorFloat = extendedADCShield.analogReadConfigNext((i+1)%8, SINGLE_ENDED, BIPOLAR, RANGE10V);//sensorValue*(5.0/1023.0);
sensorString = String(sensorFloat);
lcd.clear();
lcd.print("Channel ");
lcd.print(i);
//newline
lcd.setCursor(0,1);
lcd.print(sensorFloat);
delay(1000);
}
}