Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ignition domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /dom953964/wp-includes/functions.php on line 6131

Deprecated: Return type of GD_WordPress_File_Iterator_Filter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /dom953964/wp-content/plugins/wp_migration-master/classes/iterators.php on line 5

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the health-check domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /dom953964/wp-includes/functions.php on line 6131
Dark Makes Light RGB – Lara Grant

Dark Makes Light RGB

INPUT: Photocell
OUTPUT: RGB LED

DESCRIPTION: The darker the lighting is, the brighter all three colors go.

[code lang=”arduino” light=”true”]
int photocellPin = A6;
int ledPins[] = {
11, 10, 9 }; // an array of pin numbers to which LEDs are attached
int pinCount = 3; // the number of pins (i.e. the length of the array)

int redPin = 9; // R petal on RGB LED module connected to digital pin 11
int greenPin = 11; // G petal on RGB LED module connected to digital pin 9
int bluePin = 10; // B petal on RGB LED module connected to digital pin 10

void setup() {
Serial.begin(9600);

int thisPin;
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}

void loop() {
int photoValue = analogRead (photocellPin);
// Serial.println(photoValue); // raw analog readings

int LEDbrightness = map(photoValue, 0, 30, 0, 255);
Serial.println(LEDbrightness); //print brightness value
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin on:
analogWrite(ledPins[thisPin], LEDbrightness); // brightness of all pins at once

// Address each pin individually
//analogWrite (redPin, LEDbrightness);
// analogWrite (bluePin, LEDbrightness);
// analogWrite (greenPin, LEDbrightness);

// turn the pins off:
// digitalWrite(ledPins[thisPin], HIGH);
}
}
[/code]

Leave a Reply