Letters in typing mode
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_letter by
Diff: button.cpp
- Revision:
- 22:6931917c70cd
- Parent:
- 21:c5df903f068a
- Child:
- 23:23970cf718ee
diff -r c5df903f068a -r 6931917c70cd button.cpp --- a/button.cpp Wed Nov 01 15:22:13 2017 +0000 +++ b/button.cpp Fri Nov 03 18:56:01 2017 +0000 @@ -1,9 +1,13 @@ #include "mbed.h" #include "button.h" +#include "emic2.h" + +emic2 myTTS(p28, p27); //serial RX,TX pins to emic +//DigitalOut led4(LED4); // button constructor button::button(PwmOut servo, DigitalIn pb, int id) - : servo(servo), pb(pb), state(0), press(0), id(id){} + : servo(servo), pb(pb), state(0), press(0), id(id) {} /*button::button(PwmOut servo, DigitalIn pb, AnalogIn lp) : servo(servo), pb(pb), linpot(lp), press(0), state(0) {} */ @@ -53,10 +57,10 @@ // get current state of the button int button::getLp() { -/* if (linpot < 2) - return 1; - else*/ - return 0; + /* if (linpot < 2) + return 1; + else*/ + return 0; } // move servo into the slot @@ -93,6 +97,12 @@ moveServoIn(); state = 1; press = 1; + + // Speaker says stuff + /*myTTS.volume(18); //max volume + myTTS.speakf("S");//Speak command starts with "S" + myTTS.speakf("Hey, you pressed a pin!"); // Send the desired string to convert to speech + myTTS.speakf("\r"); //marks end of speak command*/ } // state 2 - button is down, pb = 0 if (pb == 0 && state == 1) {