Skip to content

Commit

Permalink
Add examples network time request
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaranu committed May 20, 2019
1 parent b70baf3 commit 8aeb61c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions examples/getNetworkTime/getNetworkTime.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "IoTtweetNBIoT.h"

String userid = "your-iottweet-account-id"; /*IoTtweet account user ID (6 digits, included zero pre-fix)*/
String key = "your-device-key"; /*IoTtweet registered device key in "MY IOT Garage"*/
float data0, data1, data2, data3; /*Your sending data variable.*/
String private_tweet = "Request network time"; /*Your private tweet meassage to dashboard*/
String public_tweet = "Hello IoTtweet"; /*Your public tweet message to dashboard*/

const long looptime_task1 = 5; /* Task 1 time in sec. */

unsigned long previousMillis_task1 = 0;

IoTtweetNBIoT myNBiot;

void setup(){

myNBiot.init();
previousMillis_task1 = millis();

}
void loop(){

unsigned long currentMillis_task1 = millis();

/* Task 1 */
if (currentMillis_task1 - previousMillis_task1 >= looptime_task1*1000)
{

/* Request network time */
String nt = myNBiot.getNetworkTime();
Serial.println("Network time is " + nt);

previousMillis_task1 = currentMillis_task1;
}

}

0 comments on commit 8aeb61c

Please sign in to comment.