Now that we have our Arduino IDE configured to program esp8266's and the module's wired up, we can knock together a simple program to provide a web control interface for a Neopixel ring.
The program is structured in much the same way as Blinkter, with a web interface to select the current pattern and a program loop that displays a 'frame' of the pattern's animation on each iteration.
Here we see the "spin" pattern in default, rainbow, colors:
The "solid" pattern sets all 12 Neopixels to the same color, which can be chosen by clicking on the color rectangle and using your browser's color-picker. (This screen shot shows the Chrome color-picker and the default color, which comes out as a not-too-bluey-white on the Neopixels.)
VoiceBox supports two verbal commands, "lamp on" which sets the WiLight's pattern to "solid", and "lamp off" which sets the pattern to "none":
def lamp(pattern_name):
assistant.stop_conversation()
try:
response = requests.get('http://lamp/pattern?pattern_name='+pattern_name, timeout=5)
except ConnectionError:
aiy.audio.say("Couldn't connect to lamp.")
...
def process_event(assistant, event):
...
elif event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and event.args:
...
if 'lamp on' in text:
lamp('solid')
elif 'lamp off' in text:
lamp('none')
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.