AlexaPi | Raspberry Pi Project for installing Amazon Echo
kandi X-RAY | AlexaPi Summary
kandi X-RAY | AlexaPi Summary
Raspberry Pi Project for installing Amazon Echo on your Pi
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Start speech recognition .
- Start recording .
- index API endpoint
- Get the access token
- get refresh token
- Check if internet is on .
AlexaPi Key Features
AlexaPi Examples and Code Snippets
Community Discussions
Trending Discussions on AlexaPi
QUESTION
I just have a question about running a python object in C++. Let me explain what I want to do in the following example.
...ANSWER
Answered 2017-Aug-08 at 20:42solution 1 create a small python script that calls your function and prints the result. then , in the c++ program use popen to call the python script and retrieve the displayed value.
solution 2 embed python in your c++ program https://docs.python.org/2/extending/embedding.html
if you have only very few python calls, I think solution 1 is the faster and safer way.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AlexaPi
For those of you that prefer to install the code manually or tweak things here's a few pointers... The Amazon AVS credentials are stored in a file called creds.py which is used by auth_web.py and main.py, there is an example with blank values. The auth_web.py is a simple web server to generate the refresh token via oAuth to the amazon users account, it then appends this to creds.py and displays it on the browser. main.py is the 'main' alexa client it simply runs on a while True loop waiting for the button to be pressed, it then records audio and when the button is released it posts this to the AVS service using the requests library, When the response comes back it is played back using mpg123 via an os system call, The 1sec.mp3 file is a 1second silent MP3) I found that my soundcard/pi was clipping the beginning of audio files and i was missing the first bit of the response so this is there to pad the audio. The LED's are a visual indictor of status, I used a duel Red/Green LED but you could also use separate LEDS, Red is connected to GPIO 24 and green to GPIO 25, When recording the RED LED will be lit when the file is being posted and waiting for the response both LED's are lit (or in the case of a dual R?G LED it goes Yellow) and when the response is played only the Green LED is lit. If The client gets an error back from AVS then the Red LED will flash 3 times. The internet_on() routine is testing the connection to the Amazon auth server as I found that running the script on boot it was failing due to the network not being fully established so this will keep it retrying until it can make contact before getting the auth token. The auth token is generated from the request_token the auth_token is then stored in a local memcache with and expiry of just under an hour to align with the validity at Amazon, if the function fails to get an access_token from memcache it will then request a new one from Amazon using the refresh token.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page