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.
main.cpp
00001 #include "mbed.h" 00002 //Serial twe(p9, p10); // tx, rx 00003 Serial pc(USBTX,USBRX); 00004 DigitalOut myled(LED1); 00005 00006 #define DATA_SIZE 10 00007 00008 char dam; 00009 int rpm=76; 00010 struct{ 00011 char highbyte; 00012 char lowbyte; 00013 short intdat; 00014 }data; 00015 00016 void rec(){ 00017 char DATA[DATA_SIZE] = {':', '0', '4', '0', '1', '3', '9', 'X', '\r', '\n'}; 00018 //04 00019 /*:は送信時に必要なヘッダー。78は相手のID(0x78)。01は送信コマンドとして必要。 00020 39は任意の値。Xはチェックサムの省略形。 \r\nは改行コマンド*/ 00021 00022 for (int i = 0 ; i < DATA_SIZE ; i++){ 00023 pc.putc(DATA[i]); 00024 myled=1; 00025 00026 } 00027 00028 } 00029 int main() { 00030 pc.baud(115200); 00031 00032 while(1) { 00033 //pc.putc(twe.getc()); 00034 if(pc.getc()==':'){ 00035 if(pc.getc()=='0'){ 00036 if(pc.getc()=='4'){ 00037 dam=pc.getc(); 00038 dam=pc.getc(); 00039 if(pc.getc()=='3'){ 00040 if(pc.getc()=='9'){ 00041 00042 rec(); 00043 00044 } 00045 }//if(twe.getc()=='9') 00046 }//if(twe.getc()=='4') 00047 }//0 00048 00049 00050 }//: 00051 }//while 00052 00053 }
Generated on Wed Jul 20 2022 21:39:01 by
1.7.2