Things used in this project

Schematics

Basic connections
Neopixel +5V to Vin pin of the Particle Photon
Neopixel GND to GND pin of the Particle Photon
Neopixel “Data In” pin to a digital pin of the Particle Photon
Neopixel via zerynth app 5e4rcwb0vr

Code

Code snippet #1Python
# Neopixel via Zerynth App
 
from wireless import wifi
# change the following line to use a different wifi driver
from broadcom.bcm43362 import bcm43362 as wifi_driver
 
from zerynthapp import zerynthapp
 
from adafruit.neopixel import ledstrips as neo
 
import streams
 
streams.serial()
 
num_leds = 16                     # adjust this to match the number of LEDs on your strip
led_pin = A5                      # this should match the data pin of the LED strip
 
leds = neo.LedStrip(led_pin, num_leds) # create a new Neopixel strip composed of  LEDs and connected to pin led_pin
 
leds.clear()
r = 72
g = 108
b = 108
leds.setall(r, g, b) 
 
sleep(1000)
print("STARTING...")
 
try:
    # Device UID and TOKEN can be created in the ADM panel
    zapp = zerynthapp.ZerynthApp("DEVICE UID", "DEVICE TOKEN")
    # connect to the wifi network (Set your SSID and password below)
    wifi_driver.auto_init()
    
 
    for i in range(0,5):
        try:
            wifi.link("SSID",wifi.WIFI_WPA2,"PASSWORD")
            break
        except Exception as e:
            print("Can't link",e)
    else:
        print("Impossible to link!")
        while True:
            sleep(1000)
 
    # Start the Zerynth app instance! 
    # Remember to create a template (index.html), 
    # upload it to the Zerynth ADM and associate it with the connected device
    zapp.run()
    
    def set_color(rr, gg, bb):
        global r, g, b
        r = rr
        g = gg
        b = bb
        leds.setall(r, g, b) # set the color of LEDs
    
    # link "set_color" to the function set_color
    zapp.on("set_color", set_color)
    
    
    while True:
        leds.on()       # refresh the LEDs color
        print('r = %i, g = %i, b = %i' % (r, g, b))
        print("..")
        sleep(50)   
 
except Exception as e:
    print(e)
Code snippet #2Plain text
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        
        <title>Zerynth</title>
        <!-- LOAD JQUERY AND BOOTSTRAP -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <!-- LOAD THE ZERYNTH ADM JS LIBRARY -->
        <script src="https://api.zerynth.com/zadm/latest/z.js"></script> 
        <!-- LOAD jqwidget.js -->
        <link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css" type="text/css" />
        <script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
        <script type="text/javascript" src="https://www.jqwidgets.com/public/jqwidgets/jqxcore.js"></script>
    </head>        
    <body>
        <div style="text-align:center">
            <p id="status" style="background:#ddd;font-weight:bold"></p>
            <h1>Color Picker</h1>
        </div>
        <div id="colorPicker" style="position: relative; margin: auto;"></div>
        <script>
            
             $(document).ready(function() {
                 
                 
                $("#colorPicker").jqxColorPicker({
                    width: 300,
                    height: 300,
                   colorMode: 'saturation'
                });
                
                $('#colorPicker').bind('colorchange', function (event)
                { 
                var color = $("#colorPicker").jqxColorPicker('getColor');
                    var hex = color.hex;
                    var rgb = color.r + "," + color.g + "," + color.b;
                    Z.call('set_color', [color.r, color.g, color.b]); 
                });
                
                // initialize the Z object
                Z.init({
                    on_connected:  function(){$("#status").html("CONNECTED")},
                    on_error:  function(){$("#status").html("ERROR")},
                    on_disconnected:  function(){$("#status").html("DISCONNECTED"); return true},
                    on_online:  function(evt){$("#status").html("ONLINE");},
                    on_offline:  function(evt){$("#status").html("OFFLINE");},
                    on_event:  function(evt){
                        //display received event; 
                    }
                  })
            });
         
        </script>
        
    </body>
</html>

Credits

Photo
Luigi Francesco Cerfeda

Yet another Tony Stark wannabe

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Adafruit - Rocket GPS
Easy
  • 174
  • 7

Protip

Accessory recording Adafruit GPS data that tracks your or your pet's outdoor route, decorated with traditional embroidery (of a spaceship)!

Shoe Box RetroPie Console
Easy
  • 664
  • 10

Full instructions

A RetroPie install on a Raspberry Pi Zero W with an Arcade Bonnet from Adafruit all packed in a shoe box decorated with neon duct tape.

Arduino - Web-Based Keypad
Easy
  • 3,764
  • 33

Full instructions

Remotely controlling Arduino by using web-based keypad.

Fidget Spinner RPM Counter
Easy
  • 7,475
  • 35

Protip

Arduino Project: How to make a Fidget Spinner RPM counter with Hall-effect sensor.

Arduino: Switching ON/OFF Appliances Using IR Remote
Easy
  • 2,032
  • 80

Press 'Power' to switch everything ON/OFF. Press '1' for the fan and '2' for the lights.

PHPoC: Web-Based Thermometer
Easy
  • 697
  • 16

Full instructions

This project allows you to check the temperature at home from anywhere using a web browser.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login