Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NTPClient WiflyInterface mbed
Diff: main.cpp
- Revision:
- 0:42b732f6238c
- Child:
- 1:8b6ea44e02bb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Aug 24 15:26:15 2012 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "WiflyInterface.h"
+#include "NTPClient.h"
+
+/* wifly interface:
+* - p9 and p10 are for the serial communication
+* - p19 is for the reset pin
+* - p26 is for the connection status
+* - "mbed" is the ssid of the network
+* - "password" is the password
+* - WPA is the security
+*/
+WiflyInterface wifly(p28, p27, p25, p26, "mbed", "password", WPA);
+NTPClient ntp;
+
+int main()
+{
+ wifly.init(); //Use DHCP
+
+ wifly.connect();
+
+ printf("Trying to update time...\r\n");
+ if (ntp.setTime("0.pool.ntp.org") == 0)
+ {
+ printf("Set time successfully\r\n");
+ time_t ctTime;
+ ctTime = time(NULL);
+ printf("Time is set to (UTC): %s\r\n", ctime(&ctTime));
+ }
+ else
+ {
+ printf("Error\r\n");
+ }
+
+ wifly.disconnect();
+
+ while(1) {
+ }
+}
\ No newline at end of file