Go Down

Topic: RGB LED, guidence! (New arduino user) (Read 650 times) previous topic - next topic

Dabiie

I have been programming with Processing and for 3-4 weeks I bought my first Arduino...

I just bought RGB LEDs and I want to put in a value like i could do in Processing...

I found this: http://arduino.cc/en/Reference/EsploraWriteRGB

But i need the Esplora.h file, i was wondering if its possible to somehow write similar to the reference in the URL..? (without the Esplora.h file)

Like:

digitalWrite(ledPin, HIGH(255,255,0);

or something like that?

johnwasser

Code: [Select]

// Pick the three PWM output pins that the RGB LED is connected to.
const int redPin = 3;
const int greenPin = 5;
const int bluePin = 6;

void setup() {
    pinMode(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);
}

void loop()
{
writeRGB(0, 128, 255);
delay(1000);
writeRGB(255, 0, 128);
delay(1000);
writeRGB(128, 255, 0);
}

void writeRGB( int red, int green, int blue) {
    analogWrite(redPin, red;
    analogWrite(greenPin, green);
    analogWrite(bluePin, blue);
}
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

jasonlw1



// Pick the three PWM output pins that the RGB LED is connected to.
const int redPin = 5; 
const int greenPin = 10;
const int bluePin = 9;

void setup() {
    pinMode(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);
}

void loop()
{
writeRGB(255, 255, 255); //White

}

void writeRGB( int red, int green, int blue)
{
    analogWrite(redPin, red);
    analogWrite(greenPin, green);
    analogWrite(bluePin, blue);
}





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