Skip to content

Variable _v_colour_temp is created two times when there are two RGB-LEDs configured #1737

@el-voss

Description

@el-voss

Describe the bug
I have two RGB-LEDs at an Arduino UNO and configured them in the Open Roberta Lab. When I open the code view after that, there are two variables with the same name _v_colour_temp. And when I add some blocks, that use the RGB LEDs, this variable is not used at all:

// This file is automatically generated by the Open Roberta Lab.

#include <Arduino.h>

#include <NEPODefs.h>


int _led_red_R2 = 4;
int _led_green_R2 = 5;
int _led_blue_R2 = 6;
int _v_colour_temp;  // first occurence because of first configured RGB LED
int _led_red_R = 1;
int _led_green_R = 2;
int _led_blue_R = 3;
int _v_colour_temp;  // second occurence because of second configured RGB LED
int _led_L = LED_BUILTIN;
void setup()
{
    pinMode(_led_red_R2, OUTPUT);
    pinMode(_led_green_R2, OUTPUT);
    pinMode(_led_blue_R2, OUTPUT);
    pinMode(_led_red_R, OUTPUT);
    pinMode(_led_green_R, OUTPUT);
    pinMode(_led_blue_R, OUTPUT);
    pinMode(_led_L, OUTPUT);
}

void loop()
{
    analogWrite(_led_red_R, 204);
    analogWrite(_led_green_R, 0);
    analogWrite(_led_blue_R, 0);

    analogWrite(_led_red_R2, 51);
    analogWrite(_led_green_R2, 204);
    analogWrite(_led_blue_R2, 0);

    analogWrite(_led_red_R, 0);
    analogWrite(_led_green_R, 0);
    analogWrite(_led_blue_R, 0);

}

Expected behavior
When the variable _v_colour_temp is declared, it should have added the name of the RGB-LED - like
int _v_colour_temp_R;
int _v_colour_temp_R2;

Alternatively, the variable shouldn't be declared at all, if it is never used (which I am not sure).

Device information
Tested with Firefox, Open Roberta Lab -> Arduino Uno.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions