Data Sheet
27
pr in t ( " Te m p t3 Mi dd l e : ". .t 3 . . " de g C" )
pr in t ( " Te m p t4 To p. . .: ". . t 4 . . " de g C")
pr in t ( " Te m p t5 Fl o w. .: ". . t 5 . . " de g C" )
pr in t ( " Te m p t6 Re t u r n : ". . t 6 . . " de g C" )
-- Cl e a n u p
t = ni l
ds 1 8 b2 0 = ni l
pa c kag e .l o a d e d [ " d s 1 8 b2 0 " ] =n i l
en d
tm r.a lar m ( 2 , 10 0 0 , 1, fu n c t ion ( ) get D S d at a ( ) en d )
Lesson13: Rainbow Light
Do you want to make a RGB-LED like a colorful rainbow. Here is an example of how to make it.
It is easy and only need one microcontroller pin. Now, let’s go into the colorful world.
Material:
Crowtail- ESP8266 NodeMCU x 1
Crowtail- RGB LED x 1
Hardware Connection
Open the LuaLoader, click the “Upload File…”choose ESP8266 Nod e MCU kit demo code
-> P13_Rainbow_Light -> init.lua. After the upload completed then click “Download ” to
download the init.lua file.
BRIGHT = 1
ON = BRIGHT * 255
LED_PIN = 1 -- GPIO5
PIXELS = 8
TIME_ALARM = 25 -- 0.025 second, 40 Hz
TIME_SLOW = 500000 -- 0.500 second, 2 Hz
RED = string.char( 0, ON, 0)
GREEN = string.char(ON, 0, 0)
BLUE = string.char( 0, 0, ON)