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: mbed
Fork of Lab1_Part9 by
Diff: main.cpp
- Revision:
- 0:a0adc5ccd394
- Child:
- 1:f21f8ffcd1b6
diff -r 000000000000 -r a0adc5ccd394 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jan 31 17:56:24 2018 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#include <math.h>
+
+#ifndef M_PI
+#define M_PI 3.1415
+#endif
+
+AnalogOut aout(p18);
+float value = 0.0f;
+
+int main()
+{
+ const double pi = 3.141592653589793238462;
+ while (1) {
+ for(int i= 0; i < 20; i++ ){
+ aout = sin(pi * i/10);
+ value = sin(pi * i/10);
+ printf("aout = %1.2f volts\n",aout.read());
+ wait(0.01);
+ }
+ }
+}
\ No newline at end of file
