Hi all, first time poster, long(ish) time lurker.
I have been working on an aquarium controller to switch some 12v solenoids, all working as expected except a status RGB LED i want to use…
I have the RGB LED connected to WKP/A7 (Red), A5 (Green), A4 (Blue) (all with 1k ohm resistors in series) and the 5v DC I am supplying the photon with (using a single 12v DV supply with LM7805 voltage regulator). The problem i have is that the red LED is dimly lit when it should be completely off, which i suspect has something to do with the fact i am using the WKP pin for PWM. Adding to this suspicion is that fact that it is still dimly lit when the photon is in deep sleep mode.
Anyone have any idea what i’m doing wrong? I could use a different pin instead of WKP/A7 but this would mean updating the PCB i already have and getting it re-made which i would like to avoid if possible.
https://www.youtube.com/watch?v=ahSaqaAUp_Q
The sketch is a bit complicated to control all of the solenoids and sensors, but the relevant bits for the LED are pretty much the following:
int rgbLED_r = A7;
int rgbLED_g = A5;
int rgbLED_b = A4;
int redValue = 255;
int greenValue = 255;
int blueValue = 255;
void setup() {
pinMode( rgbLED_r, OUTPUT);
pinMode( rgbLED_g, OUTPUT);
pinMode( rgbLED_b, OUTPUT);
analogWrite( rgbLED_r, redValue);
analogWrite( rgbLED_g, greenValue);
analogWrite( rgbLED_b, blueValue);
}
void loop() {
analogWrite( rgbLED_r, 100);
analogWrite( rgbLED_g, 255);
analogWrite( rgbLED_b, 255);
delay(1000);
analogWrite( rgbLED_r, 255);
analogWrite( rgbLED_g, 100);
analogWrite( rgbLED_b, 255);
delay(1000);
analogWrite( rgbLED_r, 255);
analogWrite( rgbLED_g, 255);
analogWrite( rgbLED_b, 100);
delay(1000);
analogWrite( rgbLED_r, 100);
analogWrite( rgbLED_g, 255);
analogWrite( rgbLED_b, 255);
delay(1000);
analogWrite( rgbLED_r, 255);
analogWrite( rgbLED_g, 100);
analogWrite( rgbLED_b, 255);
delay(1000);
analogWrite( rgbLED_r, 255);
analogWrite( rgbLED_g, 255);
analogWrite( rgbLED_b, 100);
delay(1000);
analogWrite( rgbLED_r, 255);
analogWrite( rgbLED_g, 255);
analogWrite( rgbLED_b, 255);
delay(1000);
System.sleep(SLEEP_MODE_DEEP, 30);
}