Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15427

Arduino ide 2.3.2 going crazy over int and variables

$
0
0

i'm making myself a lcd (rgb backlight so i have variables for each color) soundboard with buttons, and the IDE keeps spitting a crazy error:

'expected initializer before setGint'

but the line it's pointing at is:
"int setG //green set or not"

and it also goes crazy on another line:

if(setB >= 1 and setG >= 1 and setRed >= 1){ <---- this one int colorSet = 1; }

giving this error:

`
if(setB >= 1 and setG >= 1 and setRed >= 1){
^~~~~~
setuid

exit status 1
`

here's my full code:
i'm very bad at coding so there will be many errors, but i'm only concerned about it going off on those two lines

//#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#define botao1 13
#define R 33
#define G 32
#define blue 35

int pot  //0 through 255 pot value
int setG  //green set or not
int setB  //blue set or not
int setRed  //red or not
int colorSet  //all colors set or not

void setup() {
  // put your setup code here, to run once:
  pinMode(13, INPUT); //b1
  pinMode(12, INPUT); //b2
  pinMode(23, INPUT); //b3
  pinMode(14, INPUT); //b4
  pinMode(27, INPUT); //b5
  pinMode(26, INPUT); //b6

  //LiquidCrystal_I2C lcd(0x3F, 16, 2); // LCD I2C, 16 by 2

  pinMode(34, INPUT); //Pot

  pinMode(33, OUTPUT); //red
  pinMode(32, OUTPUT); //green
  pinMode(35, OUTPUT); //blue

  //lcd.backlight();  // backlight
  //lcd.cursor_off(); // turns off the blinking block of the cursor
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(colorSet < 1){
    int pot = (map(34, 0, 4096, 0, 255));
    //lcd.setCursor(6, 1);
    //lcd.print("Red:");
    //lcd.print(6, 2);
    //lcd.print(pot);
    if(digitalRead(botao1 == HIGH)){
    analogWrite(R, pot);
      }
  int setR = 1
  if(int setRed >= 1){
    //lcd.setCursor(6, 1);
    //lcd.print("Green:");
    //lcd.setCursor(6, 2);
    //lcd.print(pot);
    if(int setRed = 1 and digitalRead(botao1) == HIGH){
    analogWrite(G, pot);
    int setG = 1;
      }
  }
    if(int setG >= 1){
    //lcd.setCursor(6, 1);
    //lcd.print("Blue:");
    //lcd.setCursor(6, 2);
    //lcd.print(pot);
    if(int setG >= 1 and digitalRead(botao1 == HIGH)){
      analogWrite(blue, pot);
      int setB = 1;
      }
    }
  }
  if(setB >= 1 and setG >= 1 and setRed >= 1){
    int colorSet = 1;
  }
  if(int colorSet = 1){
    Serial.available();
    Serial.println("0");
    if(Serial.read() == 10){
      //lcd.setCursor(3, 1);
      //lcd.print("Connected!");
    }
  }
}

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 15427

Trending Articles