test
Dependents: LSI_Compass loop_test CanSat-C_test test
speak.h@3:395d8e8f9051, 2021-11-04 (annotated)
- Committer:
- ushiroji
- Date:
- Thu Nov 04 11:33:26 2021 +0000
- Revision:
- 3:395d8e8f9051
- Parent:
- 2:6eb2b256a28a
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ushiroji | 0:e190455d7dbb | 1 | #include "ATP3011.h" |
ushiroji | 0:e190455d7dbb | 2 | |
ushiroji | 0:e190455d7dbb | 3 | ATP3011 talk(D4,D5); // I2C sda scl |
ushiroji | 0:e190455d7dbb | 4 | |
ushiroji | 0:e190455d7dbb | 5 | /*地上局から新情報を送るときはflag=がでてきたらスペースか.を入力 |
ushiroji | 0:e190455d7dbb | 6 | 3秒後ぐらいにmessage=が出てくるので、そしたら新情報を入力*/ |
ushiroji | 0:e190455d7dbb | 7 | void speak(){ |
ushiroji | 0:e190455d7dbb | 8 | int timeout_ms=500; |
ushiroji | 0:e190455d7dbb | 9 | char mess[100]; |
ushiroji | 0:e190455d7dbb | 10 | if(talk.IsActive(timeout_ms)==true){ |
ushiroji | 0:e190455d7dbb | 11 | pc.printf("Active\n\rflag="); |
ushiroji | 0:e190455d7dbb | 12 | wait(3); |
ushiroji | 0:e190455d7dbb | 13 | if(pc.readable()){ |
ushiroji | 0:e190455d7dbb | 14 | pc.printf("\n\rmessage="); |
ushiroji | 0:e190455d7dbb | 15 | int i=0; |
ushiroji | 0:e190455d7dbb | 16 | do{ |
ushiroji | 0:e190455d7dbb | 17 | mess[i++]= pc.getc(); |
ushiroji | 0:e190455d7dbb | 18 | }while(mess[i-1]!= 0x0d && i<99); |
ushiroji | 0:e190455d7dbb | 19 | talk.Synthe(mess); |
ushiroji | 0:e190455d7dbb | 20 | }else{ |
ushiroji | 2:6eb2b256a28a | 21 | pc.printf("preset_message speak\r\n"); |
ushiroji | 0:e190455d7dbb | 22 | talk.Synthe("purissetommese-ji,,konnichiwa."); |
ushiroji | 0:e190455d7dbb | 23 | } |
ushiroji | 0:e190455d7dbb | 24 | }else{ |
ushiroji | 0:e190455d7dbb | 25 | pc.printf("Not Active\n"); |
ushiroji | 0:e190455d7dbb | 26 | } |
ushiroji | 0:e190455d7dbb | 27 | } |