Simple Code – Slideshow

A simple script for your Nanoleaf to display your scene in loop. Change the scene in every 5 seconds.

Code Sample

from nanoleafapi import Nanoleaf, NanoleafDigitalTwin, RED, ORANGE, YELLOW, GREEN, LIGHT_BLUE, BLUE, PINK, PURPLE, WHITE
nl = Nanoleaf("<ip_addr>")
import time
digital_twin = NanoleafDigitalTwin(nl)

effect_list = nl.list_effects()

while True:
  for i in effect_list:
    nl.set_effect(i)
    print("The current effect is: " + str(nl.get_current_effect()))
    time.sleep(1)
    print("5 seconds")
    time.sleep(1)
    print("4 seconds")
    time.sleep(1)
    print("3 seconds")
    time.sleep(1)
    print("2 seconds")
    time.sleep(1)
    print("1 second")
    
    

Leave a Reply

Your email address will not be published. Required fields are marked *