-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
24 lines (18 loc) · 765 Bytes
/
init.lua
File metadata and controls
24 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--Using integer firmware multiplying RGB by 4 is as good as setting the PWM as a percentage of RGB
--Percentage approach: pwmValue = (rgbValue / 255) * 1023
pwmConversionFactor = 4;
--Set default colour
defaultRGB = {}
defaultRGB.red = 179;
defaultRGB.green = 0;
defaultRGB.blue = 179;
--pull in RGB functions
dofile("rgb.lua")
--Initialise PWN with LED's off at 500hz
initRGB(redPin, greenPin, bluePin, 500, 0);
--Turn LEDs on to default colour
setRGB(redPin, defaultRGB.red * pwmConversionFactor, greenPin, defaultRGB.green * pwmConversionFactor, bluePin, defaultRGB.blue * pwmConversionFactor);
--set up the webpage
dofile("colourPickerWeb.lua");
--Setup the Wifi - could be delayed up to 10 seconds if has to fall back to AP mode
dofile("wifi.lua");