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.
Dependents: LSI_Compass loop_test CanSat-C_test test
speak.h@0:e190455d7dbb, 2021-10-27 (annotated)
- Committer:
- ushiroji
- Date:
- Wed Oct 27 10:15:25 2021 +0000
- Revision:
- 0:e190455d7dbb
- Child:
- 1:fe313ebd4f3b
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 | //pc.scanf("%s",mess); |
| ushiroji | 0:e190455d7dbb | 20 | talk.Synthe(mess); |
| ushiroji | 0:e190455d7dbb | 21 | }else{ |
| ushiroji | 0:e190455d7dbb | 22 | pc.printf("\n\rpreset_message speak"); |
| ushiroji | 0:e190455d7dbb | 23 | talk.Synthe("purissetommese-ji,,konnichiwa."); |
| ushiroji | 0:e190455d7dbb | 24 | } |
| ushiroji | 0:e190455d7dbb | 25 | }else{ |
| ushiroji | 0:e190455d7dbb | 26 | pc.printf("Not Active\n"); |
| ushiroji | 0:e190455d7dbb | 27 | } |
| ushiroji | 0:e190455d7dbb | 28 | } |