![](/media/cache/profiles/dee5807257e44b600e247c814cc12734.jpg.50x50_q85.jpg)
Tests the mbed Weapons and Systems Engineering Single Board Computer 12-bit ADC (MAX1270) by reading channel 0
WSESBC_ADC_Test.cpp@2:e354e2fd124c, 2015-02-10 (annotated)
- Committer:
- jebradshaw
- Date:
- Tue Feb 10 21:36:04 2015 +0000
- Revision:
- 2:e354e2fd124c
mbed WSE SBC analog to digital converter test (2 channels, +/- 10V)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jebradshaw | 2:e354e2fd124c | 1 | #include "mbed.h" |
jebradshaw | 2:e354e2fd124c | 2 | #include "mbedWSEsbc.h" |
jebradshaw | 2:e354e2fd124c | 3 | |
jebradshaw | 2:e354e2fd124c | 4 | DigitalOut myled(LED1); |
jebradshaw | 2:e354e2fd124c | 5 | |
jebradshaw | 2:e354e2fd124c | 6 | int main() { |
jebradshaw | 2:e354e2fd124c | 7 | mbedWSEsbcInit(9600); //Initialize the SBC |
jebradshaw | 2:e354e2fd124c | 8 | pc.printf("%s\r\n", __FILE__); //print the program name |
jebradshaw | 2:e354e2fd124c | 9 | |
jebradshaw | 2:e354e2fd124c | 10 | while(1) { |
jebradshaw | 2:e354e2fd124c | 11 | float ch0_volts = read_max1270_volts(0, 1, 1); |
jebradshaw | 2:e354e2fd124c | 12 | float ch1_volts = read_max1270_volts(1, 1, 1); |
jebradshaw | 2:e354e2fd124c | 13 | |
jebradshaw | 2:e354e2fd124c | 14 | pc.printf("t=%.2f CH0=%.2fV CH1=%.2fV\r\n", t.read(), ch0_volts, ch1_volts); |
jebradshaw | 2:e354e2fd124c | 15 | |
jebradshaw | 2:e354e2fd124c | 16 | led1 != led1; //Toggle LED to indicate activity |
jebradshaw | 2:e354e2fd124c | 17 | wait(0.02); |
jebradshaw | 2:e354e2fd124c | 18 | }//while(1) |
jebradshaw | 2:e354e2fd124c | 19 | }//main |