rohan gala
/
bigthingRec
BIGTHING
main.cpp@0:98be6bf27557, 2015-06-15 (annotated)
- Committer:
- rohangala
- Date:
- Mon Jun 15 06:55:22 2015 +0000
- Revision:
- 0:98be6bf27557
- Child:
- 1:630aef63181c
BIGTHING REC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rohangala | 0:98be6bf27557 | 1 | #include "mbed.h" |
rohangala | 0:98be6bf27557 | 2 | #include "stdio.h" |
rohangala | 0:98be6bf27557 | 3 | DigitalOut myled(LED1); |
rohangala | 0:98be6bf27557 | 4 | Serial pc(USBTX, USBRX); |
rohangala | 0:98be6bf27557 | 5 | Serial micro(PTD3, PTD2); // tx, rx |
rohangala | 0:98be6bf27557 | 6 | char buff[]={'\0'}; |
rohangala | 0:98be6bf27557 | 7 | |
rohangala | 0:98be6bf27557 | 8 | int num,val; |
rohangala | 0:98be6bf27557 | 9 | |
rohangala | 0:98be6bf27557 | 10 | int main() |
rohangala | 0:98be6bf27557 | 11 | {myled = 1; |
rohangala | 0:98be6bf27557 | 12 | // wait(3); |
rohangala | 0:98be6bf27557 | 13 | |
rohangala | 0:98be6bf27557 | 14 | |
rohangala | 0:98be6bf27557 | 15 | while(1) |
rohangala | 0:98be6bf27557 | 16 | { |
rohangala | 0:98be6bf27557 | 17 | if(micro.readable()) |
rohangala | 0:98be6bf27557 | 18 | { |
rohangala | 0:98be6bf27557 | 19 | myled = 0; |
rohangala | 0:98be6bf27557 | 20 | uint8_t val=(micro.getc()); |
rohangala | 0:98be6bf27557 | 21 | myled = 1; |
rohangala | 0:98be6bf27557 | 22 | |
rohangala | 0:98be6bf27557 | 23 | wait(1); |
rohangala | 0:98be6bf27557 | 24 | |
rohangala | 0:98be6bf27557 | 25 | myled = 0; |
rohangala | 0:98be6bf27557 | 26 | uint8_t num=(micro.getc()); |
rohangala | 0:98be6bf27557 | 27 | myled = 1; |
rohangala | 0:98be6bf27557 | 28 | |
rohangala | 0:98be6bf27557 | 29 | if(val == 0x01) |
rohangala | 0:98be6bf27557 | 30 | { |
rohangala | 0:98be6bf27557 | 31 | printf("The Temperature is : "); |
rohangala | 0:98be6bf27557 | 32 | pc.putc(num); |
rohangala | 0:98be6bf27557 | 33 | |
rohangala | 0:98be6bf27557 | 34 | //pc.putc(val); |
rohangala | 0:98be6bf27557 | 35 | } |
rohangala | 0:98be6bf27557 | 36 | |
rohangala | 0:98be6bf27557 | 37 | |
rohangala | 0:98be6bf27557 | 38 | |
rohangala | 0:98be6bf27557 | 39 | if(val == 0x02) |
rohangala | 0:98be6bf27557 | 40 | { |
rohangala | 0:98be6bf27557 | 41 | printf("The Lux Value is : "); |
rohangala | 0:98be6bf27557 | 42 | pc.putc(num); |
rohangala | 0:98be6bf27557 | 43 | } |
rohangala | 0:98be6bf27557 | 44 | |
rohangala | 0:98be6bf27557 | 45 | val=0x00; |
rohangala | 0:98be6bf27557 | 46 | // display.PrintInteger(num,3,0); |
rohangala | 0:98be6bf27557 | 47 | myled = 0; |
rohangala | 0:98be6bf27557 | 48 | |
rohangala | 0:98be6bf27557 | 49 | |
rohangala | 0:98be6bf27557 | 50 | // printf("%d\n\r",x); |
rohangala | 0:98be6bf27557 | 51 | wait(2); |
rohangala | 0:98be6bf27557 | 52 | myled=1; |
rohangala | 0:98be6bf27557 | 53 | } |
rohangala | 0:98be6bf27557 | 54 | } |
rohangala | 0:98be6bf27557 | 55 | } |