Controlling the intensity of LED's
in
Integration and Hardware
•
2 years ago
Hi,
Im very new to processing so I'm looking for a little bit of help. At the moment Im making an RGB LED change color by turning on the desired color and the others off, depending on a value given to it. However what I need to do is have different variations of the each colors intensity as I have more than just three values. This just is an example of the simplistic method that Im using with some of the values:
if (temp == 17)
{
arduino.digitalWrite(ledPinR, Arduino.HIGH);
arduino.digitalWrite(ledPinG, Arduino.LOW);
arduino.digitalWrite(ledPinB, Arduino.LOW);
}
if (temp == 16)
{
arduino.digitalWrite(ledPinR, Arduino.LOW);
arduino.digitalWrite(ledPinG, Arduino.HIGH);
arduino.digitalWrite(ledPinB, Arduino.LOW);
}
If I have a value of 15 I would still like the green LED to light but at a lower intensity than 16.
Any help would be greatly appreciated and I apologize for asking what is probably a very basic question.
Im very new to processing so I'm looking for a little bit of help. At the moment Im making an RGB LED change color by turning on the desired color and the others off, depending on a value given to it. However what I need to do is have different variations of the each colors intensity as I have more than just three values. This just is an example of the simplistic method that Im using with some of the values:
if (temp == 17)
{
arduino.digitalWrite(ledPinR, Arduino.HIGH);
arduino.digitalWrite(ledPinG, Arduino.LOW);
arduino.digitalWrite(ledPinB, Arduino.LOW);
}
if (temp == 16)
{
arduino.digitalWrite(ledPinR, Arduino.LOW);
arduino.digitalWrite(ledPinG, Arduino.HIGH);
arduino.digitalWrite(ledPinB, Arduino.LOW);
}
If I have a value of 15 I would still like the green LED to light but at a lower intensity than 16.
Any help would be greatly appreciated and I apologize for asking what is probably a very basic question.
1