RobotikaWall
Add message
Add a new message
Title
Text
[code] #include "LearningKit.h" void setup() { Serial.begin(115200); setupRgbLed(); setupLeds(); setupButtons(); ledcSetup(1, 1000, 10); // ledcSetup(channel, freq, resolution) // resolution = 10 => 2^10 => 1024 ledcAttachPin(L_G, 1); } int state = 1; // 1 = up, -1 = down //bool state = 1; // 1 = up, 0 = down int light = 0; void loop() { light += state; if(light == 0) { state = +1; } if(light == 1023) { state = -1; } ledcWrite(1, light); // ledcWrite(channel, value) // value => resolution = 1024 => value = 0 - 1023 delay(1); } [/code]
Password
Save