Pablo Lopez
/
MQ-135PROGRAMA
ffff
main.cpp@0:cd033d9f7ce6, 2016-09-23 (annotated)
- Committer:
- Tuxitheone
- Date:
- Fri Sep 23 19:43:30 2016 +0000
- Revision:
- 0:cd033d9f7ce6
- Child:
- 1:694ec02995df
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tuxitheone | 0:cd033d9f7ce6 | 1 | #include "mbed.h" |
Tuxitheone | 0:cd033d9f7ce6 | 2 | #include "mq135.h" |
Tuxitheone | 0:cd033d9f7ce6 | 3 | |
Tuxitheone | 0:cd033d9f7ce6 | 4 | DigitalOut myled1(LED1); |
Tuxitheone | 0:cd033d9f7ce6 | 5 | DigitalOut myled2(LED2); |
Tuxitheone | 0:cd033d9f7ce6 | 6 | DigitalOut heat(p21); |
Tuxitheone | 0:cd033d9f7ce6 | 7 | |
Tuxitheone | 0:cd033d9f7ce6 | 8 | AnalogIn sensor(p19); |
Tuxitheone | 0:cd033d9f7ce6 | 9 | Serial pc(USBTX, USBRX); //For raw data |
Tuxitheone | 0:cd033d9f7ce6 | 10 | |
Tuxitheone | 0:cd033d9f7ce6 | 11 | |
Tuxitheone | 0:cd033d9f7ce6 | 12 | int main(void) |
Tuxitheone | 0:cd033d9f7ce6 | 13 | { |
Tuxitheone | 0:cd033d9f7ce6 | 14 | while(1) { |
Tuxitheone | 0:cd033d9f7ce6 | 15 | myled1 = 1; |
Tuxitheone | 0:cd033d9f7ce6 | 16 | heat = 1; |
Tuxitheone | 0:cd033d9f7ce6 | 17 | printf("Sensor: %f\n\r", sensor.read()*3.3)-0,4919879; |
Tuxitheone | 0:cd033d9f7ce6 | 18 | |
Tuxitheone | 0:cd033d9f7ce6 | 19 | wait(2.0); |
Tuxitheone | 0:cd033d9f7ce6 | 20 | myled1 = 0; |
Tuxitheone | 0:cd033d9f7ce6 | 21 | heat = 0; |
Tuxitheone | 0:cd033d9f7ce6 | 22 | wait(0.5); |
Tuxitheone | 0:cd033d9f7ce6 | 23 | } |
Tuxitheone | 0:cd033d9f7ce6 | 24 | } |