Pages: 1 2 [3] 4   Go Down
Author Topic: Common anode RGB LED  (Read 3465 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike I replaced every single Serial with mySerial and I am still getting the error on this
Code:
ANdroid.ino: In function 'void loop()':
ANdroid:88: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:92: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:96: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:101: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:105: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:109: error: 'class SoftwareSerial' has no member named 'parseInt'
Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Come on guys. We are no longer discussing the subject of this thread "Common anode RGB LED". It is time to close this thread, tag it as (SOLVED), and create a new thread.
Logged

Good luck, Jack

Offline Offline
Edison Member
*
Karma: 64
Posts: 2455
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's FallenDemon's deal, still related though; going the holistic route.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Come on guys. We are no longer discussing the subject of this thread "Common anode RGB LED". It is time to close this thread, tag it as (SOLVED), and create a new thread.

I need help. Is this thread bothering you? Does it hurt you in any way?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33328
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike I replaced every single Serial with mySerial and I am still getting the error on this
Code:
ANdroid.ino: In function 'void loop()':
ANdroid:88: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:92: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:96: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:101: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:105: error: 'class SoftwareSerial' has no member named 'parseInt'
ANdroid:109: error: 'class SoftwareSerial' has no member named 'parseInt'
So can you post the code of this so we can try ourselves.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
//pins for the LEDs:

const int redPin = 3;

const int greenPin = 5;

const int bluePin = 6;




const int redPin2 = 9;

const int greenPin2 = 10;

const int bluePin2 = 11;




#define REDPIN 3

#define GREENPIN 5

#define BLUEPIN 6




#define FADESPEED 5

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX


void setup() {

// initialize serial:

mySerial.begin(9600);




// make the pins outputs:

pinMode(redPin, OUTPUT);

pinMode(greenPin, OUTPUT);

pinMode(bluePin, OUTPUT);




pinMode(redPin2, OUTPUT);

pinMode(greenPin2, OUTPUT);

pinMode(bluePin2, OUTPUT);




mySerial.print("Arduino control RGB LEDs Connected OK ( Sent From Arduinno Board )");

mySerial.print('\n');

}




void loop() {




// if there's any serial available, read it:

while (mySerial.available() > 0) {

 

 // look for the next valid integer in the incoming serial stream:

 int red = mySerial.parseInt();

 // do it again:

 int green = mySerial.parseInt();

 // do it again:

 int blue = mySerial.parseInt();




 int red2 = mySerial.parseInt();

 // do it again:

 int green2 = mySerial.parseInt();

 // do it again:

 int blue2 = mySerial.parseInt();




 // look for the newline. That's the end of your

 // sentence:

 if (mySerial.read() == '\n') {

           

   // constrain the values to 0 - 255 and invert

   // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"

   

   //red = 255 - constrain(red, 0, 255);

   //green = 255 - constrain(green, 0, 255);

   //blue = 255 - constrain(blue, 0, 255);

   

 red = constrain(red, 0, 255 );

 green = constrain(green, 0, 255);

 blue = constrain(blue, 0, 255);

   

 red2 = constrain(red2, 0, 255);

 green2 = constrain(green2, 0, 255);

 blue2 = constrain(blue2, 0, 255);




   // fade the red, green, and blue legs of the LED:

 analogWrite(redPin, (255 - red));

 analogWrite(greenPin, (255 - green));

 analogWrite(bluePin, (255 - blue));

   

 analogWrite(redPin2, (255 - red));

 analogWrite(greenPin2, (255 - green));

 analogWrite(bluePin2, (255 - blue));




   // print the three numbers in one string as hexadecimal:

mySerial.print("Data Response : ");

 mySerial.print(red, HEX);

 mySerial.print(green, HEX);

 mySerial.println(blue, HEX);

 }

}




}

Logged

Offline Offline
Edison Member
*
Karma: 64
Posts: 2455
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I hope you don't mind, but I took out a lot of spaces and re-formatted your code; not to be picky, but to facilitate legibility.  Demonstrates how, I think, those in the know expect to see things and which is all the more conducive to eliciting the help you seek.
Code:
//pins for the LEDs:

const int redPin = 3;
const int greenPin = 5;
const int bluePin = 6;
const int redPin2 = 9;
const int greenPin2 = 10;
const int bluePin2 = 11;

#define REDPIN 3
#define GREENPIN 5
#define BLUEPIN 6
#define FADESPEED 5

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
  // initialize serial:
  mySerial.begin(9600);
  // make the pins outputs:
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  pinMode(redPin2, OUTPUT);
  pinMode(greenPin2, OUTPUT);
  pinMode(bluePin2, OUTPUT);

  mySerial.print("Arduino control RGB LEDs Connected OK ( Sent From Arduinno Board )");
  mySerial.print('\n');
}

void loop()
{
  // if there's any serial available, read it:
  while (mySerial.available() > 0)
  {
    int red = mySerial.parseInt();
    int green = mySerial.parseInt();
    int blue = mySerial.parseInt();
    int red2 = mySerial.parseInt();
    int green2 = mySerial.parseInt();
    int blue2 = mySerial.parseInt();

    // look for the newline. That's the end of your sentence:

    if (mySerial.read() == '\n')
    {           
      // constrain the values to 0 - 255 and invert
      // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
      // red = 255 - constrain(red, 0, 255);
      // green = 255 - constrain(green, 0, 255);
      // blue = 255 - constrain(blue, 0, 255); 
      red = constrain(red, 0, 255 );
      green = constrain(green, 0, 255);
      blue = constrain(blue, 0, 255);   
      red2 = constrain(red2, 0, 255);
      green2 = constrain(green2, 0, 255);
      blue2 = constrain(blue2, 0, 255);

      // fade the red, green, and blue legs of the LED:
      analogWrite(redPin, (255 - red));
      analogWrite(greenPin, (255 - green));
      analogWrite(bluePin, (255 - blue));
      analogWrite(redPin2, (255 - red));
      analogWrite(greenPin2, (255 - green));
      analogWrite(bluePin2, (255 - blue));

      // print the three numbers in one string as hexadecimal:
      mySerial.print("Data Response : ");
      mySerial.print(red, HEX);
      mySerial.print(green, HEX);
      mySerial.println(blue, HEX);
    }

  }

}
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I need help. Is this thread bothering you? Does it hurt you in any way?
One of the main reasons I suggested starting a new thread, describing your current question, is to get you help on the current question. There may be people that have experience, and can give you help (not to say the guys working on it now can't), but, not finding your subject in an appropriate section, they never know to read the "Common anode RGB LED" thread.
First priority was, to get you help on the subject you need it on.
Second priority was, not to needlessly take up time for people that want to help with "Common anode RGB LED", by having to read many posts before they find out that that problem has already been fixed.

I wish you luck with your query. Jack
Logged

Good luck, Jack

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well understandable but you could have worded it differently. Mike did you get a chance to test that code?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33328
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well you have the line
Code:
SoftwareSerial mySerial(10, 11); // RX, TX
Those pins do not exist on the ATtiny84.
Have you seen:-
http://projectsfromtech.blogspot.co.uk/2013/06/serial-communication-on-attiny85-with.html
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike I did see that and it says that the Softwareserial will work with parseInt() however I am getting the error still. I changed the pins to 2, and 3 respectively. I don't know why it is still complaining about parseInt()???
Logged

Offline Offline
Edison Member
*
Karma: 64
Posts: 2455
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No consolation, but it compiles successfully with Uno selected.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes it does lol. I even tried the example sketch that Mike gave me from http://projectsfromtech.blogspot.co.uk/2013/06/serial-communication-on-attiny85-with.html. It complains about parseInt() and yes I am burning the bootloader to 8mHZ in order to enable softwareSerial support on the attiny chip. Yet it complains saying 'class SoftwareSerial' has no member named 'parseInt' I been trying this for 3 days and I am really close just need to get past this silly error!
Logged

Texas
Offline Offline
Edison Member
*
Karma: 25
Posts: 1298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I hate to say "I told you so", but if you had changed the thread from "common anode RGB LED" three days ago, to the real current problem, who knows, maybe someone would have found it that knew the answer. But, again, that's just my opinion.
Logged

Good luck, Jack

Offline Offline
Edison Member
*
Karma: 64
Posts: 2455
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I hate to say "I told you so",...

Now you're just being a pill.

Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Pages: 1 2 [3] 4   Go Up
Jump to: