AD7606 Library demo

Dependencies:   AD7606 mbed

main.cpp

Committer:
frada
Date:
2015-01-20
Revision:
1:ca30c6307824
Parent:
0:f0b559912391
Child:
2:7a0e156f2cc8

File content as of revision 1:ca30c6307824:

#include "mbed.h"
#include "ad7606.h"

#ifdef TARGET_KL25Z
 #define MISO    PTD3
 #define SCLK    PTD1
 #define CS      PTD0
 #define CONVST  PTD5
 #define BUSY    PTD4
 #define RESET   ???
#elif defined(TARGET_K64F)
 #define MISO    PTD3
 #define SCLK    PTD1
 #define CS      PTD0
 #define CONVST  PTC4
 #define BUSY    PTA0
 #define RESET   PTC3
#endif


Serial pc(USBTX, USBRX);
AD7606 ad7606(MISO, SCLK, CS, CONVST, BUSY, RESET, 100000);
//double analogValues[8] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
uint16_t rawValues[8] = {0, 0, 0, 0, 0, 0, 0, 0};
char buffer[100];

int main() {
    pc.baud(115200);
    pc.printf("Hello, World!\r\n");
    while(1) {
        ad7606.readRawValues(rawValues);
        //pc.printf("%d, %d, %d, %d, %d, %d, %d, %d\r\n", rawValues[0], rawValues[1],rawValues[2],rawValues[3],rawValues[4],rawValues[5],rawValues[6],rawValues[7]);
        wait_ms(100);
    }    
}