![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
tp_iot
Dependencies: mbed DHT HC_SR04_Ultrasonic_Library
Diff: main.cpp
- Revision:
- 4:74e0c3de6749
- Parent:
- 3:fcc03d78faf4
- Child:
- 5:0186f7e2053e
diff -r fcc03d78faf4 -r 74e0c3de6749 main.cpp --- a/main.cpp Wed May 24 14:23:54 2017 +0000 +++ b/main.cpp Wed May 24 15:38:43 2017 +0000 @@ -16,7 +16,9 @@ //std::string init("AT"); - std::string query("AT$SS=00 12 FF 42/r/n"); + //std::string query("AT$SS=00 12 FF 42/r/n"); + + char query[15] = "AT$SS=0012FF42"; serial_td1208.baud(9600); serial_td1208.format(); @@ -27,22 +29,12 @@ led = 1; while(1) { - /* - meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0) - meas = meas * 3300; // Change the value to be in the 0 to 3300 range - printf("measure = %.0f mV\n", meas); - if (meas > 2000) { // If the value is greater than 2V then switch the LED on - led = 1; - } - else { - led = 0; - }*/ + if (led == 1) led = 0; else led = 1; - - //serial_rd1208.write(query.c_str(), query.length(), ); + serial_td1208.printf("%s", query); wait(10); // 750 ms }