Added pwm freq setting.

This commit is contained in:
Kai Lauterbach 2023-04-30 19:54:16 +02:00
parent e0310f8c40
commit 747f7dd985

View file

@ -15,10 +15,10 @@
// D1, D2, D7, D5
uint8_t pins[LIGHTS_COUNT] = { 5, 4, 13, 14 };
IPAddress strip_ip(192, 168, 0, 26); // choose an unique IP Adress
IPAddress gateway_ip(192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
IPAddress dns(192, 168, 0, 1);
IPAddress strip_ip (192, 168, 0, 26); // choose an unique IP Adress
IPAddress gateway_ip (192, 168, 0, 1); // Router IP
IPAddress subnet_mask(255, 255, 255, 0);
IPAddress dns (192, 168, 0, 1);
//********************************//
@ -39,6 +39,7 @@ IPAddress dns(192, 168, 0, 1);
#define SCENE_NIGHTLY 2
// 10 bit PWM
#define PWM_FREQ (50000UL)
#define PWM_OFF 0 // 0V
#define PWM_MIN 0 // 0V - minimum light amount (~1%)
#define PWM_MAX 255 // 24V - maximum light amount (100%)
@ -259,6 +260,8 @@ void setup()
Serial.print("IP: ");
Serial.println(myIP);
analogWriteFreq(PWM_FREQ);
if (!light_state[0])
{
// Show that we are connected
@ -729,7 +732,7 @@ void init_webserver()
http_content += "<label for=\"bri" + (String)light_num + "\">Bri</label>";
http_content += "<input id=\"bri" + (String)light_num + "\" onchange=\"sendSliderValue(" + (String)(light_num+1) + ")\" name=\"bri" + (String)light_num + "\" type=\"range\" min=\"0\" max=\"255\" value=\"" + (String)bri[light_num] + "\">";
http_content += "&nbsp;<span id=\"bri" + (String)light_num + "_val\" name=\"bri" + (String)light_num + "\">" + (String)(int)(bri[light_num] * 100.0 / 255.0) + "</span>%";
http_content += "<br><label for=\"light" + (String)light_num + "_pwm\">PWM-Wert</label>";
http_content += "<br><label for=\"light" + (String)light_num + "_pwm\">PWM-Value</label>";
http_content += "<input type=\"range\" min=\"0\" max=\"100\" value=\"0\" id=\"light" + (String)light_num + "_pwm\" disabled>";
http_content += "&nbsp;<span id=\"light" + (String)light_num + "_pwm_txt\"></span>%";
http_content += "<script>";