system
1
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?
// 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);
}
system
3
// 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);
}