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.
Fork of twe_lite_rpm by
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 11 00007 00008 char s[11] ;//this can take up to 10 byte characters 00009 00010 char dam; 00011 short int rpm=76; 00012 struct{ 00013 char highbyte; 00014 char lowbyte; 00015 short intdat; 00016 }data; 00017 00018 char highbyte,lowbyte; 00019 00020 00021 void rec(){ 00022 rpm+=1000; 00023 00024 sprintf(s, ":0401%dX\r\n",rpm); 00025 /*配列sにまとめて代入。*/ 00026 for (int i = 0 ; i < DATA_SIZE ; i++){ 00027 pc.putc(s[i]); 00028 } 00029 rpm-=1000; 00030 } 00031 int main() { 00032 pc.baud(115200); 00033 00034 while(1) { 00035 //pc.putc(twe.getc()); 00036 if(pc.getc()==':'){ 00037 if(pc.getc()=='0'){ 00038 if(pc.getc()=='4'){ 00039 dam=pc.getc(); 00040 dam=pc.getc(); 00041 if(pc.getc()=='3'){ 00042 if(pc.getc()=='9'){ 00043 00044 rec(); 00045 00046 } 00047 }//if(twe.getc()=='9') 00048 }//if(twe.getc()=='4') 00049 }//0 00050 00051 00052 }//: 00053 }//while 00054 00055 }
Generated on Thu Sep 1 2022 17:04:37 by
1.7.2
