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:25af5436ac17, committed 2018-02-23
- Comitter:
 - Joeatsumi
 - Date:
 - Fri Feb 23 04:21:22 2018 +0000
 - Commit message:
 - 2018/2/23
 
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 | 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 23 04:21:22 2018 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+//Serial twe(p9, p10); // tx, rx
+Serial pc(USBTX,USBRX);
+DigitalOut myled(LED1);
+
+#define DATA_SIZE 10
+
+char dam;
+int rpm=76;
+struct{
+    char highbyte;
+    char lowbyte;
+    short intdat;
+    }data;
+
+void rec(){
+     char DATA[DATA_SIZE] = {':', '0', '4', '0', '1', '3', '9', 'X', '\r', '\n'};
+                //04
+                /*:は送信時に必要なヘッダー。78は相手のID(0x78)。01は送信コマンドとして必要。
+                  39は任意の値。Xはチェックサムの省略形。 \r\nは改行コマンド*/
+                  
+                for (int  i = 0 ; i < DATA_SIZE ; i++){  
+                     pc.putc(DATA[i]);
+                     myled=1;
+                     
+                     }
+                     
+    }
+int main() {
+       pc.baud(115200);
+       
+    while(1) {
+                             //pc.putc(twe.getc());
+             if(pc.getc()==':'){
+                 if(pc.getc()=='0'){
+                     if(pc.getc()=='4'){
+                        dam=pc.getc();
+                        dam=pc.getc();
+                        if(pc.getc()=='3'){
+                        if(pc.getc()=='9'){
+                               
+                               rec();
+                               
+                               }
+                                      }//if(twe.getc()=='9')
+                                }//if(twe.getc()=='4')
+                               }//0
+                
+        
+                    }//:
+             }//while
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 23 04:21:22 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file