Tim H / Mbed 2 deprecated Nucleo_analog_out

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
timXH
Date:
Wed May 04 11:12:09 2022 +0000
Commit message:
test

Changed in this revision

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 4dd35df7bd92 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 04 11:12:09 2022 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+AnalogOut  aout(PA_5);
+ 
+float brightness = 0.0;
+uint8_t char1 = 0;
+uint8_t char2 = 0;
+uint16_t dac_out = 0;
+uint8_t rec1_flag =0;
+
+
+ 
+int main() {
+    pc.printf("Send two bytes for control of A2\n");
+ 
+    while(1) {
+        char c = pc.getc();
+        if (rec1_flag ==0){
+            char1 = c; 
+            rec1_flag=1;
+        
+        }
+        else{
+            char2 = c; 
+            rec1_flag=0;
+            dac_out = ((uint16_t)char1 << 8) | char2;
+            aout.write_u16(dac_out);
+            pc.putc('A');
+            pc.putc('C');
+            pc.putc('K');
+            pc.putc('\n');
+                  
+            
+        }
+
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 4dd35df7bd92 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 04 11:12:09 2022 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file