Im having an issue with a roving networks wifi bee module from Tinysine.
The datasheet says:
-
The command time - sets the rtc clock according to the ntp server specified, Im using the default.
-
My library's function getRTC - calls the module's show t t\r - which shows the time from the rtc on the wifi module.
But for some reason it reboots when I use those commands and I get a neverending 2 second delay Alarms set in the serial monitor. Here is the sketch:
#include <Wire.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
void terminal();
WiFly wifly; //WIFI
String data; //WIFI
const byte bufferSize = 32;
char dataBufferToReceive[bufferSize]; //for the time
int dataSize = 256; //for the size
long int uptime;
char timezone;
long int rtc;
char MyTime[20];
void setup(){
Serial.begin(9600);
Serial.println("Alarms set!");
delay(2000);
thisandthat();
}
void thisandthat(){
// set time from ntp
//wifly.setTimeAddress("129.6.15.30");//ntp-nist.ldsbc.net"); //28, 29 or 64.113.32.5 or 216.229.0.179
//wifly.setTimePort(123);
//wifly.setTimezone(7);
//wifly.setTimeEnable(5); //maybe because we dont want it to set time on powerup
//wifly.time(); //this line causes it to reboot?
//wifly.save();
delay(1000);
// there must have been a line with MyTime that I erased
//uptime = wifly.getUptime();
//timezone = wifly.getTimezone();
//rtc = wifly.getRTC();
Serial.print("uptime: ");
Serial.println(uptime);
Serial.print("timezone: ");
Serial.println(timezone);
Serial.print("rtc: ");
//Serial.println(rtc);
Serial.print("MyTime from wifly getTime: ");
//Serial.println(MyTime);
Serial.println("Getting time proper... ");
//Get time from wifi module
//if (wifly.time()) { // My testing of rtc
//print time
delay(1000); // My testing of rtc below
//int something = wifly.getRTC();
Serial.print("RTC from wifly getRTC: ");
//Serial.println(something);
Serial.print("Time of buf: ");
//Serial.println(wifly.getTime(dataBufferToReceive, sizeof(dataBufferToReceive)));
//} else {
Serial.println("Failed to get time");
//}
}
void loop(){
//Alarm.delay(10);
}
void MorningAlarm() {
//Serial.print("Firing Alarm");
}
/* Connect the WiFly serial to the serial monitor. */
void terminal(){
while (1) {
if (wifly.available() > 0) {
Serial.write(wifly.read());
}
if (Serial.available() > 0) {
wifly.write(Serial.read());
}
}
}