Sample Code of http://ohurochan.jp/blog/?p=446 Added SerialController to control BitPattern from PC via Serial. Based on https://developer.mbed.org/users/tandk1124/code/LED_BitPattern/

Dependencies:   mbed

Fork of LED_BitPattern by Takuma Arai

Added Control class for SeirialPC. You can change LED Lighting Bit Pattern from PC Serial. Type "1" to set countup. Type "0" to set countdown.

/media/uploads/tandk1124/bitpattern2log.jpeg

Revision:
5:683d6fff1ebc
Child:
6:3e4a21461691
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CtrlBase.hpp	Tue Mar 07 00:14:42 2017 +0000
@@ -0,0 +1,26 @@
+#include <mbed.h>
+
+Serial pc(USBTX, USBRX);
+Serial uart(p28, p27);
+
+class CtrlBase{
+public:
+    CtrlBase(Serial& tgt) : _refTarget(tgt){};
+    bool isReadable(){
+        return _refTarget.readable();
+    };
+    char getc(){ return _refTarget.getc(); };
+    void putc(char c){ _refTarget.putc(c); };
+private:
+    Serial& _refTarget;
+};
+
+class CtrlPCSerial : public CtrlBase {
+public:
+    CtrlPCSerial(): CtrlBase(pc){};
+};
+
+class CtrlUART : public CtrlBase{
+public:
+    CtrlUART(): CtrlBase(pc){};
+};