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.
Dependencies: BufferedSerial SDFileSystem mbed
Revision 6:c9e732e94d7f, committed 2022-09-10
- Comitter:
- MatsumotoKouki
- Date:
- Sat Sep 10 10:17:09 2022 +0000
- Parent:
- 5:15559c6d6a5f
- Commit message:
- Nichrome wo file ni write suru bubunn wo add sita kedo work ka wakarann
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Sep 10 06:11:36 2022 +0000
+++ b/main.cpp Sat Sep 10 10:17:09 2022 +0000
@@ -25,12 +25,14 @@
int sig=0;
Ticker comm;
char str[10];
+char NichromeCom[11]={0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
int getSignal(); //f303からのコマンドを受け取る関数
//void JY901(); //JY901が取得した生データをSDに書き込む関数
void getGPS(); //GPSデータを取得し、f303に送信する関数
void StandbyCommand();
void MakeFile();
+void writeNichrome();
int main()
{
@@ -38,14 +40,14 @@
unsigned char CalibMag[5]={0xFF,0xAA,0x01,0x02,0x00};
unsigned char SetHeight[5]={0xFF,0xAA,0x01,0x03,0x00};
unsigned char ExitCalib[5]={0xFF,0xAA,0x01,0x00,0x00};
- comm.attach(StandbyCommand,1); //割り込みで1秒ごとにf303からのコマンドを取得
+ comm.attach(StandbyCommand,0.4); //割り込みで1秒ごとにf303からのコマンドを取得
/**********************
//センサーのsleepモードを終わらせて、キャリブレーションを開始する関数
*****************/
jy901.write(CalibGyroAcc,5);
- wait(30);
+ wait(45);
jy901.write(CalibMag,5);
wait(30);
jy901.write(SetHeight,5);
@@ -67,12 +69,21 @@
//printf("StandbyCommand start\r\n");
sig=getSignal();
switch(sig) {
- case 2:
+
+ /*case 1: //ニクロム線作動
+ fputc("0x55",fp);
+ printf("Nichrome ON!!\r\n");
+ for(int i=0; i<10;i++){
+ fputc("0x00",fp);
+ }
+ break;*/
+
+ case 2: //フライトピン
//comm.detach();
MakeFile();
break;
- case 3:
+ case 3: //ブザー作動
comm.detach();
while(1) {
getGPS();
@@ -84,14 +95,17 @@
void MakeFile()
{
mkdir("/sd/2021MR", 0777);
- FILE *fp = fopen("/sd/2021MR/chigusa.bin", "w");
+ FILE *fp = fopen("/sd/2021MR/chigusa.bin", "wb");
if(fp == NULL) {
error("Could not open file for write\n");
}
while(sig!=3) {
fputc(jy901.getc(),fp);
- //JY901();
+ if(sig==1){
+ fwrite(&NichromeCom,sizeof(NichromeCom[0]),sizeof(NichromeCom),fp);
+ sig=2;
+ }
}
fclose(fp);
}
@@ -246,6 +260,4 @@
}
j++;
}
-
-
}
\ No newline at end of file