ok
Dependencies: mbed
main.cpp@1:0260e05c8e83, 2017-11-28 (annotated)
- Committer:
- DeanArm7
- Date:
- Tue Nov 28 16:40:36 2017 +0000
- Revision:
- 1:0260e05c8e83
- Parent:
- 0:0302f3c057c9
Now with connected grounds and serial display;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DeanArm7 | 0:0302f3c057c9 | 1 | #include "mbed.h" |
DeanArm7 | 0:0302f3c057c9 | 2 | |
DeanArm7 | 0:0302f3c057c9 | 3 | DigitalOut myled1(LED1); |
DeanArm7 | 0:0302f3c057c9 | 4 | DigitalOut myled2(LED2); |
DeanArm7 | 0:0302f3c057c9 | 5 | |
DeanArm7 | 1:0260e05c8e83 | 6 | AnalogIn tempin(p16); |
DeanArm7 | 1:0260e05c8e83 | 7 | |
DeanArm7 | 1:0260e05c8e83 | 8 | Serial pc(USBTX, USBRX); // tx, rx |
DeanArm7 | 1:0260e05c8e83 | 9 | |
DeanArm7 | 0:0302f3c057c9 | 10 | |
DeanArm7 | 0:0302f3c057c9 | 11 | int main() { |
DeanArm7 | 0:0302f3c057c9 | 12 | myled1 = 0; |
DeanArm7 | 0:0302f3c057c9 | 13 | myled2 = 0; |
DeanArm7 | 1:0260e05c8e83 | 14 | float test=0; |
DeanArm7 | 0:0302f3c057c9 | 15 | |
DeanArm7 | 0:0302f3c057c9 | 16 | while(1) { |
DeanArm7 | 0:0302f3c057c9 | 17 | wait(0.5); |
DeanArm7 | 1:0260e05c8e83 | 18 | |
DeanArm7 | 1:0260e05c8e83 | 19 | test = tempin; |
DeanArm7 | 1:0260e05c8e83 | 20 | pc.printf("%f\n\r",test); |
DeanArm7 | 1:0260e05c8e83 | 21 | if(tempin > 0.28f){ //going above max temp |
DeanArm7 | 0:0302f3c057c9 | 22 | myled1 = 0; |
DeanArm7 | 0:0302f3c057c9 | 23 | myled2 = 1; |
DeanArm7 | 0:0302f3c057c9 | 24 | } |
DeanArm7 | 1:0260e05c8e83 | 25 | if(tempin < 0.28f){ //going below max temp |
DeanArm7 | 0:0302f3c057c9 | 26 | myled1 = 1; |
DeanArm7 | 0:0302f3c057c9 | 27 | myled2 = 0; |
DeanArm7 | 0:0302f3c057c9 | 28 | } |
DeanArm7 | 0:0302f3c057c9 | 29 | } |
DeanArm7 | 0:0302f3c057c9 | 30 | } |