Go Down

Topic: RGB LED color change using serial communication (Read 1 time) previous topic - next topic

lokefar

Hi

I wanna make a sketch that when I write certain frases to it via the serial monitor will make an RGB LED light up in certain ways.
I would like to be able to write the RGB code and get the according color (ex: 255 0 0 for red).
Besides that I would like to be able to write "pulse" or something like that and the colors just morphes/changes through the spectrum.

I've found several different tutorial/guides etc. but I can't seem to find one that I can get to work.

So what I'm looking for is:
1) Either the code that would make this work
2) A guide that works
3) A tutorial/guide to writing sketches that use serial communication

AWOL

Quote
I've found several different tutorial/guides etc. but I can't seem to find one that I can get to work.

Perhaps if you could post one of them, we could help you make it work.

Or, break the problem down into "how do I reliably transfer triplets of numbers across a serial link?" and the other simpler bit, then do a search for "PaulS SOP EOP" and see where that leads.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

lokefar

#2
Mar 12, 2012, 05:20 pm Last Edit: Mar 12, 2012, 05:36 pm by lokefar Reason: 1
I tried this one:
http://www.homebuiltrovs.com/rovforum/viewtopic.php?f=15&t=97

But only with only code for one of the RGB LED legs. I think the problem there was something with this line:
Code: [Select]
default:
      // any other key pressed will turn the lights off..
      for (int thisPin = 2; thisPin < 6; thisPin++) {
        digitalWrite(thisPin, LOW);

In that code, I don't really get how to change the:
Code: [Select]
// initialize the LED pins:
      for (int thisPin = 2; thisPin < 6; thisPin++) {
        pinMode(thisPin, OUTPUT);
      }

To only the RGB LED pins (which are on three non-continous pins for PWM purpose (3,5,6 on an UNO))

I've got this one working now for the pulsating color:
http://www.mbeckler.org/microcontrollers/rgb_led/

The "problem" here is I don't quite understand the update section and the color_morph.

Edit: I figured out the update section and color_morph. So the question now is primarily about the serial communication.

Grumpy_Mike

Quote
The "problem" here is I don't quite understand the update section and the color_morph.

The problem here is that you don't understand even the most basic fundamentals of how code works. Like trying to teach a man with no legs to run.
The solution if for you to do some of the tutorials in the learning section, learning how to turn a digital pin on and off and driving a PWM pin.
http://arduino.cc/hu/Tutorial/HomePage

lokefar

Ignore the question. Figured it all out a different way around.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy