Tests the mbed Weapons and Systems Engineering Single Board Computer 12-bit ADC (MAX1270) by reading channel 0
main.cpp@1:d68db4c0f92c, 2014-10-16 (annotated)
- Committer:
- jebradshaw
- Date:
- Thu Oct 16 18:02:22 2014 +0000
- Revision:
- 1:d68db4c0f92c
- Parent:
- 0:5134e66ab306
Simple ADC test (MAX1270) on mbed WSE SBC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jebradshaw | 0:5134e66ab306 | 1 | #include "mbed.h" |
jebradshaw | 0:5134e66ab306 | 2 | #include "mbedWSEsbc.h" |
jebradshaw | 0:5134e66ab306 | 3 | |
jebradshaw | 0:5134e66ab306 | 4 | DigitalOut myled(LED1); |
jebradshaw | 0:5134e66ab306 | 5 | |
jebradshaw | 0:5134e66ab306 | 6 | int main() { |
jebradshaw | 0:5134e66ab306 | 7 | mbedWSEsbcInit(9600); //Initialize the SBC |
jebradshaw | 0:5134e66ab306 | 8 | |
jebradshaw | 0:5134e66ab306 | 9 | while(1) { |
jebradshaw | 0:5134e66ab306 | 10 | float ch0_volts = read_max1270_volts(0, 0, 0); |
jebradshaw | 0:5134e66ab306 | 11 | |
jebradshaw | 0:5134e66ab306 | 12 | pc.printf("t=%.2f CH0=%.3fV \r", t.read(), ch0_volts); |
jebradshaw | 0:5134e66ab306 | 13 | led1 != led1; |
jebradshaw | 0:5134e66ab306 | 14 | wait(0.02); |
jebradshaw | 0:5134e66ab306 | 15 | }//while(1) |
jebradshaw | 0:5134e66ab306 | 16 | }//main |