This sample shows how to control your pumpkin using Azure IoT Central, with lights and a spooky sound.
Set up the speaker and lights as described in the spooky-sounds
and single-pixel
demos.
You will need an IoT Central app to control the app. You can find out more about how to use IoT Central in the Azure IoT Central documentation
-
If you don't have an Azure account, sign up:
- If you are a student, you can sign up for Azure for Students. You can also activate Azure for students via the GitHub student developer pack. Azure for students gives you $100 of credit each year you are a student, and you don't need a credit card to sign up.
- If you are not a student, you can sign up for an Azure free account. You will need a credit card for verification, but your card will not be charged. This account gives you $200 of credit for the first 30 days.
-
Head to apps.azureiotcentral.com
-
Create a new IoT Central app. As long as you are setting up only 1 or 2 pumpkins, IoT Central is free on any tier.
-
Create a new device template called
pumpkin
with 2 commands -Scare
andLight
. TheScare
command has no parameters, and theLight
has oneString
parameter calledColor
-
Create a device with this template.
-
Get the connection details for the device.
-
Configure your audio device and ensure it works
-
Install the apt packages
-
Install the Pip packages using
sudo
:sudo pip3 install -r requirements.txt
-
Open the
app.py
file. -
Read the
app.py
code to understand what it does. -
Update the
SPEAKER_CARD_NUMBER
to the card number for your speaker. -
Update
PIXEL_COUNT
to the number of pixels you are using. -
Update
ID_SCOPE
,DEVICE_ID
andPRIMARY_KEY
to the values from the connection dialog in IoT Central -
Run the
app.py
sample usingsudo
:sudo python3 app.py
-
Control the lights and sound from IoT Central. When executing the
Light
command, pass the required color as a 6-character hex string in theColor
field.