speak=sc.get(‘J’) keeps returning the last thing said

I ran 12.app_control.py and turned on the speaker. I tried saying “hello there” and it correctly recognized that. The problem is that 12.app_control.py kept printing that over and over and over again. I finally had to kill 12.app_control.py. It appears that speak=sc.get(‘J’) keeps returning the last thing that was said every time through the loop. It would be easy enough to add some logic to only print what was said if it changed, but I wanted to make sure that I wasn’t missing something. Why does that keep returning the last thing said when nothing new has been said?

This is a known issue with the `12.app_control.py` demo code — `sc.get(“J”)` correctly returns the recognized speech, but the demo loop does not handle deduplication, so it reprints the last result when nothing new is spoken.

This is not your fault — our demo code needs improvement. We will add deduplication logic and release an update. You can download the new version when available.

Temporary workaround:

1. Open `/home/pi/SunFounder_Controller/12.app_control.py` (path may vary based on your installation)

2. In the main loop `while True:`, after `speak = sc.get(“J”)`:

```python

last_speak = None # add before the loop

speak = sc.get(“J”)

if speak and speak != last_speak: # add this check

   print(speak)  # indent under if

   last_speak = speak  # update

```

3. Save the file (Ctrl+O Enter, Ctrl+X with nano)

4. Re-run: `python3 12.app_control.py`

If you prefer not to edit code, please wait for our updated release.

Thanks, that is what I needed. My solution worked except that it would not recognize the same thing said more than once in a row. Mainly I was missing “If speak”. Now it works as it should.

Will Windham

Congratulations! :tada: I’m glad to hear the issue is resolved.

If you have any further questions, feel free to reach out.