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.
Revision 0:4dd35df7bd92, committed 2022-05-04
- 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