Skip to content

Commit

Permalink
🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Apr 30, 2021
1 parent 2f5fdc5 commit 8fa9928
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
1 change: 0 additions & 1 deletion examples/anvil-app-blinkt.json

This file was deleted.

49 changes: 49 additions & 0 deletions examples/anvil-colour-control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Basic example for controlling the Blinkt LED colours via Anvil
# Learn more at: https://anvil.works/
#
# Dependencies:
#
# python3 -m pip install blinkt colour anvil-uplink
#
# Run this example with:
#
# python3 anvil-colour-control.py
#
# You'll be prompted for an email address to set up the web control
# portion of this example.
#
# Check your email, click the link and- when the app has loads -
# hit the "Run" button at the top to start remote-controlling
# your Blinkt!

import blinkt
from colour import Color

from anvil.app_creator import create_app
import anvil.server

# Create the Blinkt demo app in your Anvil account
app = create_app("blinkt")

# Define functions that can be called from your Anvil app on the web
anvil.server.connect(app.uplink_key)

@anvil.server.callable
def set_color(color_string):
print("Setting LEDs to {}".format(color_string))
c = Color(color_string)
blinkt.set_all(c.red*255, c.green*255, c.blue*255, 1.0)
blinkt.show()

@anvil.server.callable
def clear():
print("Clearing LEDs")
blinkt.clear()
blinkt.show()

# Display the URL where you can control the Blinkt LEDS
print("Control your Blinkt LEDs at {}".format(app.origin))
print("Press Ctrl-C to exit")

# Keep the script running until the user exits with Ctrl-C
anvil.server.wait_forever()

0 comments on commit 8fa9928

Please sign in to comment.