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 #include "Serial.h" 00003 Serial pc(USBTX, USBRX); 00004 Serial device(PA_2,PA_3); 00005 Serial im920(PA_9,PA_10,19200); 00006 DigitalOut led(LED1); 00007 DigitalOut cam_sw1(D10); //カメラの電源スイッチに接続(Highで電源ON) 00008 DigitalOut cam_sw2(D9); //カメラの撮影スイッチ(FET)に接続(HighでD-S導通) 00009 00010 00011 char str[10]; 00012 int i=0; 00013 int k=0; 00014 void cmd(){ 00015 while(1) { 00016 if(pc.readable()) { //IM920からのデータがある場合 00017 char temp = pc.getc();//一文字読み込む 00018 if(temp != '\r') { //読み込み文字が改行で無い場合 00019 str[i] = temp; 00020 i++; 00021 } else if(temp == '\r') { //読み込み文字が改行の場合 00022 if(str[i-1]=='S'||'s'){ 00023 cam_sw1 = 1; //カメラの電源スイッチON 00024 wait(3); 00025 cam_sw1 = 0; 00026 wait(10); //カメラの電源ON 00027 while(i<5){ 00028 led=1; 00029 wait(0.5); 00030 i++; 00031 } 00032 }else if(str[i-1]=='T'||'t'){ 00033 cam_sw2 = 1; //撮影スイッチON(撮影開始指示) 00034 wait(0.2); //撮影開始 00035 cam_sw2=0; 00036 }else if(str[i-1]=='E'||'e'){ 00037 cam_sw2=1; //撮影スイッチON(撮影終了指示) 00038 wait(0.2); //撮影終了 00039 cam_sw2=0; 00040 }else if(str[i-1]=='A'||'a'||'B'||'b'||'C'||'c'){ 00041 //device.putc(str); 00042 }else{ 00043 pc.printf("command error"); 00044 } 00045 } 00046 } 00047 } 00048 } 00049 int main(){ 00050 pc.attach(cmd,Serial::RxIrq); 00051 while(1){ 00052 } 00053 }
Generated on Sun Sep 4 2022 10:57:17 by
