James Fan / Mbed 2 deprecated RPC_USBSerial

Dependencies:   mbed-rpc mbed

Files at this revision

API Documentation at this revision

Comitter:
jooter
Date:
Thu Aug 29 00:09:41 2013 +0000
Commit message:
RPC over USB serial testing step by step

Changed in this revision

KL25Z_RPC_instruction.txt Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rpc.lib 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
serial_raw_rpc_test.py.txt Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r b8cfe8c7e985 KL25Z_RPC_instruction.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/KL25Z_RPC_instruction.txt	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,36 @@
+
+KL25Z RPC testing step by step
+
+Get start - mBed firmware installation
+http://mbed.org/platforms/KL25Z/
+
+mBed firmware
+http://mbed.org/media/uploads/samux/mbed_if_v2.0_frdm_kl25z.s19
+
+
+
+Install RPC_USBSerial into KL25Z
+Register into mbed.org;
+Select platform KL25Z in compiler;
+Import program, Compile, download RPC_USBSerial.bin to PC;
+Save RPC_USBSerial.bin to MBED drive;
+
+
+Serial Communication with a PC
+http://mbed.org/handbook/SerialPC
+
+
+
+Windows serial configuration
+http://mbed.org/handbook/Windows-serial-configuration
+
+
+Find COM Port number, "COM?", at:
+Control Panel > Syetem > Hardware > Device Manager > Ports(COM & LPT) > Mbed Virtual Serial Port(COM?)
+
+
+install python 2.7
+install pyserial http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.win32.exe/download
+
+
+Copy/Paste from serial_raw_rpc_test.py.txt to python command line terminal
\ No newline at end of file
diff -r 000000000000 -r b8cfe8c7e985 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/USBDevice/#0e8e73ebaa40
diff -r 000000000000 -r b8cfe8c7e985 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "USBSerial.h"
+#include "mbed_rpc.h"
+
+USBSerial pc;
+
+int main() {
+    // setup the classes that can be created dynamically
+   /*
+    RPC::add_rpc_class<RpcAnalogIn>();
+    RPC::add_rpc_class<RpcAnalogOut>();
+*/
+    RPC::add_rpc_class<RpcDigitalIn>();
+    RPC::add_rpc_class<RpcDigitalOut>();
+    RPC::add_rpc_class<RpcDigitalInOut>();
+    RPC::add_rpc_class<RpcPwmOut>();
+
+    RPC::add_rpc_class<RpcTimer>();
+    RPC::add_rpc_class<RpcSPI>();
+
+  //  RPC::add_rpc_class<RpcBusOut>();
+  //  RPC::add_rpc_class<RpcBusIn>();
+  //  RPC::add_rpc_class<RpcBusInOut>();
+    RPC::add_rpc_class<RpcSerial>();
+    // receive commands, and send back the responses
+    char buf[256], outbuf[256];
+    while(1) {
+        pc.gets(buf, 256);
+        RPC::call(buf, outbuf); 
+        pc.printf("%s\n", outbuf);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r b8cfe8c7e985 mbed-rpc.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rpc.lib	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rpc/#4490a0d9cb2a
diff -r 000000000000 -r b8cfe8c7e985 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file
diff -r 000000000000 -r b8cfe8c7e985 serial_raw_rpc_test.py.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial_raw_rpc_test.py.txt	Thu Aug 29 00:09:41 2013 +0000
@@ -0,0 +1,25 @@
+# 
+# install python 2.7
+# install pyserial http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.win32.exe/download
+
+import serial
+import time
+ser = serial.Serial(port='COM11', baudrate=9600, timeout=0)
+def ser_command (v):
+    ser.write(v + '\n')
+
+ser_command('/PwmOut/new LED1 blue') # turn on
+ser_command('/blue/write 1') # turn off
+ser_command('/blue/write 0.98') # dimm 
+ser_command('/blue/read')
+ser_command('/blue/read')
+ser_command('/blue/read')
+ser_command('/blue/read')
+ser_command('/blue/read')
+ser_command('/blue/read')
+
+
+for i in range(100):
+    time.sleep(0.1)
+    ser.write('/blue/write '+ str(i/100.0) + '\n')
+    print(i/100.0)