yuuki takiya
/
mbed_22
a
main.cpp@0:2b8a8135f8cf, 2014-07-09 (annotated)
- Committer:
- ty0715
- Date:
- Wed Jul 09 07:40:22 2014 +0000
- Revision:
- 0:2b8a8135f8cf
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ty0715 | 0:2b8a8135f8cf | 1 | #include "mbed.h" |
ty0715 | 0:2b8a8135f8cf | 2 | #include "SCP1000.h" |
ty0715 | 0:2b8a8135f8cf | 3 | |
ty0715 | 0:2b8a8135f8cf | 4 | Serial xbee(p9,p10); |
ty0715 | 0:2b8a8135f8cf | 5 | Serial pc(USBTX, USBRX); |
ty0715 | 0:2b8a8135f8cf | 6 | SCP1000 scp1000(p5,p6,p7,p8); |
ty0715 | 0:2b8a8135f8cf | 7 | DigitalOut a(p19); |
ty0715 | 0:2b8a8135f8cf | 8 | AnalogIn UV(p20); |
ty0715 | 0:2b8a8135f8cf | 9 | PwmOut servo(p21); |
ty0715 | 0:2b8a8135f8cf | 10 | |
ty0715 | 0:2b8a8135f8cf | 11 | int main() { |
ty0715 | 0:2b8a8135f8cf | 12 | float temp; |
ty0715 | 0:2b8a8135f8cf | 13 | //char sv; |
ty0715 | 0:2b8a8135f8cf | 14 | |
ty0715 | 0:2b8a8135f8cf | 15 | a=0; |
ty0715 | 0:2b8a8135f8cf | 16 | //servo.period_us(32000); |
ty0715 | 0:2b8a8135f8cf | 17 | while(1) { |
ty0715 | 0:2b8a8135f8cf | 18 | |
ty0715 | 0:2b8a8135f8cf | 19 | |
ty0715 | 0:2b8a8135f8cf | 20 | temp=UV; |
ty0715 | 0:2b8a8135f8cf | 21 | |
ty0715 | 0:2b8a8135f8cf | 22 | //sv=xbee.getc(); |
ty0715 | 0:2b8a8135f8cf | 23 | //sv=xbee.getc(); |
ty0715 | 0:2b8a8135f8cf | 24 | //if(sv=='O'){ |
ty0715 | 0:2b8a8135f8cf | 25 | //servo=0.02; |
ty0715 | 0:2b8a8135f8cf | 26 | //printf("O\n"); |
ty0715 | 0:2b8a8135f8cf | 27 | // } |
ty0715 | 0:2b8a8135f8cf | 28 | //if(sv=='C'){ |
ty0715 | 0:2b8a8135f8cf | 29 | // servo=0.04; |
ty0715 | 0:2b8a8135f8cf | 30 | // printf("C\n"); |
ty0715 | 0:2b8a8135f8cf | 31 | // } |
ty0715 | 0:2b8a8135f8cf | 32 | |
ty0715 | 0:2b8a8135f8cf | 33 | printf("%8.2f#,",temp*3300); |
ty0715 | 0:2b8a8135f8cf | 34 | printf("%d@,%4.1f\n", scp1000.readPressure(), scp1000.readTemperature()); |
ty0715 | 0:2b8a8135f8cf | 35 | |
ty0715 | 0:2b8a8135f8cf | 36 | xbee.printf("$%8.2f#",temp*3300); |
ty0715 | 0:2b8a8135f8cf | 37 | xbee.printf("%d@%4.1f\n", scp1000.readPressure(), scp1000.readTemperature()); |
ty0715 | 0:2b8a8135f8cf | 38 | |
ty0715 | 0:2b8a8135f8cf | 39 | wait(0.5); |
ty0715 | 0:2b8a8135f8cf | 40 | |
ty0715 | 0:2b8a8135f8cf | 41 | |
ty0715 | 0:2b8a8135f8cf | 42 | } |
ty0715 | 0:2b8a8135f8cf | 43 | } |