Go Down

Topic: Seeed Studio RGY programming (Read 730 times) previous topic - next topic

Gizmobizmo8

There should only be one loop() function.
I've erased that line for the 2nd loop, and this is what I got:

void setup() {
  // put your setup code here, to run once:int redPin= 7;
int greenPin = 6;
int bluePin = 5;
void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}
void loop() {
  setColor(255, 0, 0); // Red Color
  delay(1000);
  setColor(0, 255, 0); // Green Color
  delay(1000);
  setColor(0, 0, 255); // Blue Color
  delay(1000);
  setColor(255, 255, 255); // White Color
  delay(1000);
  setColor(170, 0, 255); // Purple Color
  delay(1000);
}
$$$$$void setColor(int redValue, int greenValue, int blueValue) {
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);

}




}

The $$$$$ indicates where the error message is.  Thanks for your response.

Grumpy_Mike

#16
Aug 21, 2019, 05:09 pm Last Edit: Aug 21, 2019, 05:10 pm by Grumpy_Mike
FFS stop posting code like this. You have been told many times before. If you are not smart enough to post code correctly you are not smart enough to understand any answers you might get.

You have one too many } at the end.

Gizmobizmo8

FFS stop posting code like this. You have been told many times before. If you are not smart enough to post code correctly you are not smart enough to understand any answers you might get.

You have one too many } at the end.
Okay, sorry for the incorrect format.  I saw a similar format when I googled this error code.  I'll read the guidelines for the forum, I'm not understanding the guidelines, but I'll be sure to understand before posting.  For some reason, when I erase a {, I get the same error message.  It'd be nice if I could get an example, instead of all of this negative feedback.

septillion

We do want to help you. But for us it's also hobby. And for that we don't like sifting though a whole load of crap. That's why we made clear forum rules and instructions. Keeps it fun for us, gives you an answer quick. Sounds like a win-win situation, doesn't it?
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Grumpy_Mike

#19
Aug 21, 2019, 07:00 pm Last Edit: Aug 21, 2019, 07:02 pm by Grumpy_Mike
Quote
For some reason, when I erase a {, I get the same error message.
If that is what you did, the reason is that you did not do what I said in reply #16 did you.

Quote
It'd be nice if I could get an example, instead of all of this negative feedback.
It would be nice if you actually took some time to cooperate with us.

Gizmobizmo8

Okay sorry guys, I'm not good at coding.  I took C once at ITT, and the teacher wasn't that great.  I didn't want to drag this out as long as it has been going.  I'll do some close analyzing.

Gizmobizmo8

< void loop() {
  setColor(255, 0, 0); // Red Color
  delay(1000);
  setColor(0, 255, 0); // Green Color
  delay(1000);
  setColor(0, 0, 255); // Blue Color
  delay(1000);
  setColor(255, 255, 255); // White Color
  delay(1000);
  setColor(170, 0, 255); // Purple Color
  delay(1000);>

This is the new error message I'm getting.  I hope I put this in the right format.  I've tried erasing the {'s before I got on here, and it still didn't work.

Gizmobizmo8

Okay, sorry once again.  I've finally figured out how to show my code.  I figured it was something in the tool bar.  I guess I didn't see it in the toolbar, because it's not an option in quick reply. 
Code: [Select]
void loop() {
  setColor(255, 0, 0); // Red Color
  delay(1000);
  setColor(0, 255, 0); // Green Color
  delay(1000);
  setColor(0, 0, 255); // Blue Color
  delay(1000);
  setColor(255, 255, 255); // White Color
  delay(1000);
  setColor(170, 0, 255); // Purple Color
  delay(1000);
   }

Gizmobizmo8

#23
Aug 21, 2019, 10:54 pm Last Edit: Aug 21, 2019, 10:57 pm by Gizmobizmo8
Okay, so everytime I erase a {, it's like I have to keep erasing them?  I don't understand why it's not compiling.  I put $$$$'s where I'm getting the error message.
Code: [Select]
void setup() {
  // put your setup code here, to run once:    int redPin= 7;
    int greenPin = 6;
    int bluePin = 5;
    void setup() {
      pinMode(redPin, OUTPUT);
      pinMode(greenPin, OUTPUT);
      pinMode(bluePin, OUTPUT);
    }
    void loop() {
      setColor(255, 0, 0); // Red Color
      delay(1000);
      setColor(0, 255, 0); // Green Color
      delay(1000);
      setColor(0, 0, 255); // Blue Color
      delay(1000);
      setColor(255, 255, 255); // White Color
      delay(1000);
      setColor(170, 0, 255); // Purple Color
      delay(1000);
    }
    $$$$void setColor(int redValue, int greenValue, int blueValue) {
      analogWrite(redPin, redValue);
      analogWrite(greenPin, greenValue);
      analogWrite(bluePin, blueValue);
    }

}

void loop() {
  // put your main code here, to run repeatedly:

}

UKHeliBob

Quote
I guess I didn't see it in the toolbar, because it's not an option in quick reply. 
There is an option in your profile to "Use full editor in Quick Reply" which causes the toolbar to be shown
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Gizmobizmo8

There is an option in your profile to "Use full editor in Quick Reply" which causes the toolbar to be shown
Okay, I'll enable that feature, thanks.   So am I formatting this wrong or what?

septillion

I put $$$$'s where I'm getting the error message.
Instead of doing that, just past the whole error message here! It has way more info than $$$$...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Gizmobizmo8

Instead of doing that, just past the whole error message here! It has way more info than $$$$...
Okay sorry once again.  I just got off work, so I will do it once I get settled.

david_2018

Code: [Select]

void setup() {  // << ******************* remove this line, you already have a void setup() in the sketch 3 lines below this
  // put your setup code here, to run once:    int redPin= 7;
    int greenPin = 6;
    int bluePin = 5;  // << ********************** need to add a definition for redPin
    void setup() {
      pinMode(redPin, OUTPUT);
      pinMode(greenPin, OUTPUT);
      pinMode(bluePin, OUTPUT);
    }
    void loop() {
      setColor(255, 0, 0); // Red Color
      delay(1000);
      setColor(0, 255, 0); // Green Color
      delay(1000);
      setColor(0, 0, 255); // Blue Color
      delay(1000);
      setColor(255, 255, 255); // White Color
      delay(1000);
      setColor(170, 0, 255); // Purple Color
      delay(1000);
    }
    void setColor(int redValue, int greenValue, int blueValue) {
      analogWrite(redPin, redValue);
      analogWrite(greenPin, greenValue);
      analogWrite(bluePin, blueValue);
    }

} //<< ************************************** remove this closing bracket


// <<****************************** remove everything below here
void loop() {
  // put your main code here, to run repeatedly:

}

Gizmobizmo8

Code: [Select]

void setup() {  // << ******************* remove this line, you already have a void setup() in the sketch 3 lines below this
  // put your setup code here, to run once:    int redPin= 7;
    int greenPin = 6;
    int bluePin = 5;  // << ********************** need to add a definition for redPin
    void setup() {
      pinMode(redPin, OUTPUT);
      pinMode(greenPin, OUTPUT);
      pinMode(bluePin, OUTPUT);
    }
    void loop() {
      setColor(255, 0, 0); // Red Color
      delay(1000);
      setColor(0, 255, 0); // Green Color
      delay(1000);
      setColor(0, 0, 255); // Blue Color
      delay(1000);
      setColor(255, 255, 255); // White Color
      delay(1000);
      setColor(170, 0, 255); // Purple Color
      delay(1000);
    }
    void setColor(int redValue, int greenValue, int blueValue) {
      analogWrite(redPin, redValue);
      analogWrite(greenPin, greenValue);
      analogWrite(bluePin, blueValue);
    }

} //<< ************************************** remove this closing bracket


// <<****************************** remove everything below here
void loop() {
  // put your main code here, to run repeatedly:

}


WAAAH LAAAH!!!! IT WORKED!!!! THANKS SO MUCH.  I'm taking a programming for Engineering class next week, so I'm just trying to prepare in advance.  Sorry guys for all the confusion.  So, do you know a good source code for a RGB Seeed Studio touchscreen?

Go Up