![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
trainning_template
main.cpp
- Committer:
- brainliang
- Date:
- 2020-12-01
- Revision:
- 5:7534fc9248a8
- Parent:
- example.cpp@ 4:fe1e9f9c7b33
- Child:
- 6:398753e95e87
File content as of revision 5:7534fc9248a8:
#define HIGH 1 #define LOW 0 #include "mbed.h" #include <string> typedef bool boolean; typedef std::string String; #include "sensors.h" #include "converters.h" int gasOK; boolean item; Serial Serial_2(PA_2,PA_3); YL analog_PC_15(PC_15,PA_0); DigitalOut myDigitalOutPC_13(PC_13); int main() { Serial_2.baud(9600); item = 0; while (true) { item = !item; myDigitalOutPC_13.write(item); wait_ms(1000); if (analog_PC_15==true) { gasOK = analog_PC_15.read(); Serial_2.printf("gas: %d\n",_p(gasOK)); } } }