Daniele Mazzei
Published © GPL3+

Smartify FRYEBO the Ikea Lamp

An interactive lamp that shows multiple information through different colored LED. Remotely controlled by smartphone through the VIPER app.

BeginnerFull instructions provided2,043
Smartify FRYEBO the Ikea Lamp

Things used in this project

Hardware components

FRYEBO Ikea Lamp
×1
Spark Core
Particle Spark Core
Particle Photon or Arduino Due work too.
×1
Adafruit Neopixel 24 LEDs ring
×1

Software apps and online services

VIPER

Story

Read more

Code

template.py

Python
########################################
# file:    template.py
# project: ViperApp
# created: Fri Feb 20 2015 19:01:51 GMT+0100 (CET)
########################################


def get():
    return """
        <html>
        <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="jquery-mobile/jquery.mobile-1.4.5.min.css">
        <link rel="stylesheet" href="jquery/tinycolorpicker/tinycolorpicker.css">
        <script src="viperapp.js"></script>
        <script src="jquery/jquery.js"></script>
        <script src="jquery-mobile/jquery.mobile-1.4.5.min.js"></script>
        </head>
        <body>
        <div data-role="page">
                <div data-role="header"><h1>Led Lamp</h1></div>
                <div class='content' data-role='content' style="width:30%;margin:0 auto">
                    <div class="ui-btn" onclick="ViperApp.call('newcolor')">Change</div>
                </div>
        </div>
        </body>
        </html>
        """

main.py

Python
########################################
# file:    main.py
# project: ViperApp
# created: 2015-02-20 18:59:11.454827
########################################

import viperapp
import template
import wifi
from drivers.neopixel import ledstrips as neo

# Connect to your Wifi
wifi.connect("Viper",WIFI_WPA2,"toiviper")

# Initialize Neopixel ledstrip
leds = neo.ledstrip(D2,24)
leds.clear()

# Create the ViperApp!
app = viperapp.ViperApp("Led Lamp","Viper Powered Led Lamp",template)

# callback to change color
def newcolor():    
    leds.set_fading(random(0,100),random(0,100),random(0,100))

# add the callback to the app and give it a name
app.on("newcolor",newcolor)

# Run!
app.run()


# Initialize the leds
newcolor()
leds.on()
delay = 100

# Go on forever rotating the leds
while True:
    sleep(delay)
    leds.lshift()
    leds.on()

Credits

Daniele Mazzei

Daniele Mazzei

2 projects • 9 followers

Comments