MSOE EE2905 / Mbed 2 deprecated MATLAB_controls_light

Dependencies:   mbed

Revision:
0:ab5b6bca3e25
Child:
1:e9cb1aec787c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 06 01:09:21 2017 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+/*  MATLAB can send data over to the Nucleo to control its operation or
+to output data via AnalogOut, etc.  In this case, MATLAB sends a number and the
+onboard LED is set to blink that many times in 2 seconds.
+*/
+PwmOut light(LED1);
+Serial matlab(USBTX,USBRX);
+int main() {
+    int x;
+    light=0.5;  // turn on light
+    while(1){
+        matlab.scanf("%d",&x);  // get number from MATLAB
+        light.period(2.0/x);    // set new period for blinking
+    }
+  
+}