﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>ESP32 Discussions</title>
    <description>Latest discussions happening in the ESP32 category</description>
    <link>https://www.aboveunity.com</link>
    <item>
      <title>ESP32 and Alexa Voice Controls</title>
      <description>&lt;p&gt;My Friends,&lt;/p&gt;&#xD;
&lt;p&gt;Toying around with Voice to Environment Control, the ESP32 and Alexa, is very easy to get some things going!&lt;/p&gt;&#xD;
&lt;p&gt;I have been using the Library: &lt;a href="https://github.com/Aircoookie/Espalexa"&gt;ESPAlexa&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;The example is clear and precise:&lt;/p&gt;&#xD;
&lt;blockquote&gt;&#xD;
&lt;p dir="auto"&gt;Espalexa is designed to be as simple to use as possible.&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;First, you'll need a global object declaration and a prototype for the function that Espalexa will call when the device is changed:&lt;/p&gt;&#xD;
&lt;pre class="language-cpp"&gt;&lt;code&gt;#include &amp;lt;Espalexa.h&amp;gt;&#xD;
void firstDeviceChanged(uint8_t brightness);&#xD;
Espalexa espalexa;&lt;/code&gt;&lt;/pre&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;You then want to actually add the callback function (one for each device)&lt;/p&gt;&#xD;
&lt;pre class="language-cpp"&gt;&lt;code&gt;void firstDeviceChanged(uint8_t brightness) {&#xD;
  //brightness parameter contains the new device state (0ff,255n,1-254immed)&#xD;
  //do what you'd like to happen here (e.g. control an LED)&#xD;
}&lt;/code&gt;&lt;/pre&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;In your setup function, after you connected to WiFi, you'd want to add your devices:&amp;nbsp;&lt;/p&gt;&#xD;
&lt;pre class="language-cpp"&gt;&lt;code&gt;espalexa.addDevice("Alexa name of the device", firstDeviceChanged);&lt;/code&gt;&lt;/pre&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;The first parameter of the function is a string with the invocation name, the second is the name of your callback function (the one Espalexa will call when the state of the device was changed) You may also add a third&amp;nbsp;&lt;code&gt;uint8_t&lt;/code&gt;&amp;nbsp;parameter that will specify the default brightness at boot.&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;Below the device definition in setup, add:&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;pre class="language-cpp"&gt;&lt;code&gt;espalexa.begin();&lt;/code&gt;&lt;/pre&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;Finally, in the loop() function, add:&lt;/p&gt;&#xD;
&lt;pre class="language-cpp"&gt;&lt;code&gt;espalexa.loop();&lt;/code&gt;&lt;/pre&gt;&#xD;
&lt;p dir="auto"&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;And that's it!&lt;/p&gt;&#xD;
&lt;p dir="auto"&gt;Ref: &lt;a href="https://github.com/Aircoookie/Espalexa"&gt;ESPAlexa&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;/blockquote&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Very cool and very easy! Simple coding and simple examples to follow!&lt;/p&gt;&#xD;
&lt;p&gt;The ESP32 is a really nice, reasonable well priced Microcontroller!&lt;/p&gt;&#xD;
&lt;p&gt;&lt;img style="display: block; margin-left: auto; margin-right: auto;" src="../../content/uploads/b5d8d256-5657-4ec2-ac7c-a741014a20b4/7c18b76a-002f-4d34-a63a-b0b000028d13_esp32-36-pin-pinout.jpg?width=690&amp;amp;upscale=false" alt=""&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Small and powerful!&lt;/p&gt;&#xD;
&lt;p&gt;Here is a very good video, showing you hoe easy this is:&lt;/p&gt;&#xD;
&lt;p&gt;https://www.youtube.com/watch?v=iZWcyZDXMDc&lt;/p&gt;&#xD;
&lt;p&gt;https://www.youtube.com/watch?v=JI0AE6BdHZc&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xD;
&lt;p&gt;Although there are some limitations here, it appears some of these limitations may be by design, from a security point of view from Alexa programming side.&lt;/p&gt;&#xD;
&lt;p&gt;Best Wishes,&lt;/p&gt;&#xD;
&lt;p&gt;&amp;nbsp; &amp;nbsp;Chris&lt;/p&gt;</description>
      <pubDate>2023-11-04T00:12:01.8200000</pubDate>
      <link>https://www.aboveunity.com/thread/esp32-and-alexa-voice-controls/</link>
    </item>
  </channel>
</rss>