acd52832_IR_led example.

Dependencies:   aconno_bsp_Fork1 mbed

Files at this revision

API Documentation at this revision

Comitter:
jurica238814
Date:
Wed Sep 21 11:49:08 2016 +0000
Commit message:
acd52832_IR_led.

Changed in this revision

aconno_bsp.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/aconno_bsp.lib	Wed Sep 21 11:49:08 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jurica238814/code/aconno_bsp_Fork1/#0b2820f57ca4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 21 11:49:08 2016 +0000
@@ -0,0 +1,67 @@
+/* Copyright (c) 2016 Aconno. All Rights Reserved.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ *   aconno simple example program
+ *   IR LED sends "SOS" in the world
+ */
+ 
+ 
+#include "mbed.h"
+#include "acd52832_bsp.h"
+
+#define DOT_LENGTH 0.5                      // Dot length (duration) in seconds
+#define DASH_LENGTH (DOT_LENGTH * 3)         // Dash length (duration)
+#define ELEMENTS_PAUSE (DOT_LENGTH)          // Pause between elements
+#define CHARS_PAUSE (DOT_LENGTH * 3)    // Pause between characters
+#define WORDS_PAUSE (DOT_LENGTH *7)          // Pause between words
+
+#define ON 1
+#define OFF 0
+
+
+DigitalOut IrLED(PIN_IRLED);
+
+void dot(DigitalOut LED){
+    // Turn IR LED ON
+    LED = ON;
+    wait(DOT_LENGTH);
+    // Turn it off
+    LED = OFF;
+    wait(ELEMENTS_PAUSE);
+    }
+
+void dash(DigitalOut LED){
+    // Turn IR LED ON
+    LED = ON;
+    wait(DASH_LENGTH);
+    // Turn it off
+    LED = OFF;
+    wait(ELEMENTS_PAUSE);
+}
+
+void S_code(DigitalOut LED){
+    dot(LED);
+    dot(LED);
+    dot(LED);
+}
+
+void O_code(DigitalOut LED){
+    dash(LED);
+    dash(LED);
+    dash(LED);
+}
+
+
+int main(){
+    while(1){
+        S_code(IrLED);
+        wait(CHARS_PAUSE);
+        O_code(IrLED);
+        wait(CHARS_PAUSE);
+        S_code(IrLED);
+        wait(WORDS_PAUSE);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 21 11:49:08 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85
\ No newline at end of file