General ArduinoGravity

How to programmatically tell DF2301Q to pause and resume speech recognition?

userHead Hari 2024-05-27 06:36:09 121 Views0 Replies

My DF2301Q is working fine using I2C.
However, when I try to have it pause listening, I can't seem to wake it back up once I set setWakeTime to zero.

 

To put it to “sleep” I used DF2301Q.setWakeTime(0); // This pauses listening

 

To wake it up, I've tried:

DF2301Q.setWakeTime(15); // Does not work

and 

DF2301Q.playByCMDID(1); // Does not work. (I think playByCMDID crashes the Arduino)

DF2301Q.playByCMDID(-1); // Does not work. 

 

I've attached my test sketch that would put the recognition to sleep and wake up using GPIO D2 and D3.

I also put a println in loop.  You can see that sometimes that stops indicating that loop no longer runs :-(

 

What is the proper way to programmatically put DF2301Q to sleep (ignore voice commands) and wake it up (start responding to voice commands again)?  Thank you!

 

 

icon DF2301Q_Sleep_Wake_Test.zip 1KB Download(0)