Small demo of the Helios class

Dependencies:   Helios mbed

Files at this revision

API Documentation at this revision

Comitter:
acracan
Date:
Sun Jun 24 12:11:32 2018 +0000
Commit message:
Small demo of the Helios class

Changed in this revision

Helios.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0d5e0666c53b Helios.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Helios.lib	Sun Jun 24 12:11:32 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/acracan/code/Helios/#ad31da30ae64
diff -r 000000000000 -r 0d5e0666c53b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jun 24 12:11:32 2018 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "Helios.h"
+
+/*------------------------------------------------------------------------------
+Before to use this example, ensure that you an hyperterminal installed on your
+computer. More info here: https://developer.mbed.org/handbook/Terminals
+
+The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their
+definition in the PinNames.h file).
+
+The default serial configuration in this case is 9600 bauds, 8-bit data, no parity
+
+If you want to change the baudrate for example, you have to redeclare the
+serial object in your code:
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+Then, you can modify the baudrate and print like this:
+
+pc.baud(115200);
+pc.printf("Hello World !\n");
+------------------------------------------------------------------------------*/
+
+DigitalOut led(LED1);
+Helios sun;
+
+int main()
+{
+    time_t seconds;
+    char buffer[32];
+
+    printf("Hello World !\n");
+    set_time(1529836800);    
+    while(1) {
+        wait(1); // 1 second
+        led = !led; // Toggle LED
+        seconds = time(NULL);
+        sun.updatePosition();
+        strftime(buffer, 32, "%H:%M:%S", localtime(&seconds));
+        printf("UTC time is: %s\n", buffer);
+        printf("Sun azimuth: %.2f, elevation: %.2f\n", sun.azimuth(), sun.elevation());
+    }
+}
diff -r 000000000000 -r 0d5e0666c53b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jun 24 12:11:32 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file