Jjun Deng / Mbed 2 deprecated WDR_additional_counter

Dependencies:   libmDot mbed-rtos mbed

Fork of CardRead_20170613 by wireless sensor

Revision:
19:a0e9128dec64
Parent:
18:12be4d4c8fc2
Child:
20:d19c1cec6d42
diff -r 12be4d4c8fc2 -r a0e9128dec64 main.cpp
--- a/main.cpp	Mon Jun 12 17:01:42 2017 +0000
+++ b/main.cpp	Tue Jun 13 05:14:31 2017 +0000
@@ -50,12 +50,12 @@
 string pwr_stat_str;
 std::string pwr_on_str =  "ON";
 std::string pwr_off_str = "OFF";
-
+string acstatus;
 mDot* dot;
 
 static std::string config_network_name = "chinaiot";
 static std::string config_network_pass = "password";
-static uint8_t config_frequency_sub_band = 8; 
+static uint8_t config_frequency_sub_band = 2; 
 
 int main() 
 {    
@@ -90,24 +90,28 @@
     
     while(1) {
         /* Read Card ID */
-        readCardID();
+        //readCardID();
         
         /* Send Card ID to gateway */
         sendCardID();
         
         /* wait a while */
         wait(1); 
-        if (pwr_cnt == 31){       
-             pwr_cnt = 0;
+        /*if (pwr_cnt == 31){       
+             pwr_cnt = 0;*/
              if(pwr_stat == 1){
-                send_data("ON");
+                acstatus ="AC ON";
+                send_data("AC ON");
              }else{
-                send_data("OFF");    
-             }    
-        }     
-        else {
+                acstatus ="AC OFF";
+                send_data("AC OFF");    
+             } 
+           pc.printf("AC status is %s\n\r", acstatus);     
+            
+        
+        /*else {
             pwr_cnt++;
-        }         
+        } */        
     }
 }
 
@@ -135,14 +139,17 @@
     // frequency sub band is only applicable in the 915 (US) frequency band
     // if using a MultiTech Conduit gateway, use the same sub band as your Conduit (1-8) - the mDot will use the 8 channels in that sub band
     // if using a gateway that supports all 64 channels, use sub band 0 - the mDot will use all 64 channels
-    int32_t setTxFrequency(const uint32_t& FB_868);
+    
+    //int32_t setTxFrequency(const uint32_t& FB_868);// setting for 868MHZ
+
+
     
   
-    //pc.printf("Setting frequency sub band\n\r");
-    //if ((ret = dot->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) {
-    //    pc.printf("Error:failed to set frequency sub band %d:%s\n\r", ret, mDot::getReturnCodeString(ret).c_str());
-    //    return RETURN_ERR;
-    //}
+    pc.printf("Setting frequency sub band\n\r");
+    if ((ret = dot->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) {
+        pc.printf("Error:failed to set frequency sub band %d:%s\n\r", ret, mDot::getReturnCodeString(ret).c_str());
+        return RETURN_ERR;
+    }
 
     pc.printf("Setting network name\n\r");
     if ((ret = dot->setNetworkName(config_network_name)) != mDot::MDOT_OK) {