Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/schmidtsi76327/ESP8266_Treppenlicht
This commit is contained in:
commit
dbf2d51769
@ -27,4 +27,4 @@ upload_flags =
|
||||
lib_deps =
|
||||
|
||||
# The exact version
|
||||
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
|
||||
ottowinter/PCA9685 16-Channel PWM Driver Module Library @ 1.2.9
|
||||
|
14
src/main.cpp
14
src/main.cpp
@ -83,7 +83,7 @@ void setup_webserver() {
|
||||
|
||||
|
||||
|
||||
|
||||
PCA9685 pwmController;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
@ -91,6 +91,9 @@ void setup() {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
Wire.begin(); // Wire must be started first
|
||||
Wire.setClock(400000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
|
||||
|
||||
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
||||
Serial.println("Connection Failed! Rebooting...");
|
||||
delay(5000);
|
||||
@ -142,6 +145,15 @@ void setup() {
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
setup_webserver();
|
||||
|
||||
pwmController.resetDevices(); // Software resets all PCA9685 devices on Wire line
|
||||
|
||||
pwmController.init(B000000); // Address pins A5-A0 set to B000000
|
||||
pwmController.setPWMFrequency(200); // Default is 200Hz, supports 24Hz to 1526Hz
|
||||
|
||||
pwmController.setChannelPWM(0, 128 << 4); // Set PWM to 128/255, but in 4096 land
|
||||
|
||||
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user