Control RGB LED 5050 Stripe with IOT Remote

SOLVED (after 6h) Version1.0:-)

This Guys helped a lot:

=> Dashboard: i created 3 x Dimmed light (3 Outputs r; g; b)

#include "thingProperties.h"

void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);

// Defined in thingProperties.h
initProperties();

// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode( 9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}

void loop() {
ArduinoCloud.update();
}

void onRChange() {
uint8_t brightness = map(r.getBrightness(), 0, 100, 0, 255);
if (r.getSwitch()){
Serial.println(brightness);
analogWrite(11, brightness);
}
else{
analogWrite(11,LOW);
}
}

void onGChange() {
uint8_t brightness = map(g.getBrightness(), 0, 100, 0, 255);
if (g.getSwitch()){
Serial.println(brightness);
analogWrite(10, brightness);
}
else{
analogWrite(10,LOW);
}
}

void onBChange() {
uint8_t brightness = map(b.getBrightness(), 0, 100, 0, 255);
if (b.getSwitch()){
Serial.println(brightness);
analogWrite(9, brightness);
}
else{
analogWrite(9,LOW);
}
}

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

Hi Thanks,

sorry i have no error code all works. im looking for a simply code for:

  • to change values for:
    #define RED_LED 9
    #define BLUE_LED 10
    #define GREEN_LED 11

simultany i also look for a solution, thanks so much and greetings.

Robert

What exactly do you want to change ?

Hi :slight_smile: i want to change the PIN9,10,11 output via IOT Cloud (iOT Remote), so im looking for the right declaration for variables.

=>Solution see first Post<= Thanks and greetings

I think that you saying that you want to change state of the pins via the IOT Cloud. Is that correct ?