Too Much Output? [SOLVED]

Hi,

I am using a Nano to run a door control system including a pinpad, a 1602 LCD run by shift register (595) and an RGB LED for bling. I am not using the Red on the LED as it may have popped. controlling the access is one of those optically isolated relays from eBay. I have also added an output for another relay for some lights to be installed later.

my main problem is that my LEDS arent working - the Green and Blue Pins. I know the LED is ok I have tested it with a simpler code.
EDIT: should mention that the RGB is a common positive (Anode?) with a 1k res between it and 5V

Is it being blocked somewhere? Can anybody see anything wrong with my code? or do I have too much attached drawing current?
also first post so sorry if this is in the wrong spot.

Cheers in advance for any help.

here is my code:

#include <LiquidCrystal_SR.h>
#include <LCD.h>
#include <Password.h>
#include <Wire.h>
#include <OnewireKeypad.h>

//Setup LCD
// setting the pins for the shift register Data, Clock, Enable
LiquidCrystal_SR lcd(2, 3, 4);

//Setup Keypad
char KEYS[] =
{
  '1', '2', '3',
  '4', '5', '6',
  '7', '8', '9',
  '*', '0', '#',
};

OnewireKeypad <Print, 12> PadS(Serial, KEYS, 4, 3, A1, 4700, 1000);

//Get our numbers right
int Blue = 11;
int Green = 12;
int Blight = 9;
int Relay = 7;
int Reset = 8;
int Lights = 6;

//setup for using millis timers
unsigned long MagTime;
unsigned long LtTime;
unsigned long EvalTime;
boolean Magnet = false;
boolean Light = false;
boolean Evaluated = false;


//set password
Password password = Password( "2501" );
Password LitUp = Password( "0" );

byte maxLength = 4; // how long the password will be
byte currentLength = 0;

void setup()
{
  Serial.begin(9600);// for input prepad, and output diag
  //Reset needs to be set before anything else
  digitalWrite(Reset, HIGH);
  pinMode(Reset, OUTPUT);
  //Set up the pins
  pinMode(Blue, OUTPUT);
  pinMode(Green, OUTPUT);
  pinMode(Blight, OUTPUT);
  pinMode(Relay, OUTPUT);
  pinMode(Lights, OUTPUT);
  //make sure pins in correct state to start
  digitalWrite(Lights, HIGH);
  digitalWrite(Relay, HIGH);
  digitalWrite(Blue, LOW);
  digitalWrite(Green, HIGH);
  digitalWrite(Blight, HIGH);
  //Begin the boot
  lcd.begin(16, 2);
  BlueFlash();
  lcd.setCursor(3, 0);
  lcd.print("Code then #");//info for the uninformed
  lcd.setCursor(3, 1);
  lcd.print("* to Reset");
  delay(1500);
  digitalWrite(Blight, LOW);
  lcd.clear();

}

void loop()
{
//using OneWireKeypad to capture entries. Library is easy to find
  if (PadS.Getkey())
  {
    char keyP = PadS.Getkey();
    PadS.SetHoldTime(150);
    if (PadS.Key_State() == 3)
    {
      switch (keyP)
      {
        case '*': //reset entry if made a mistake
          ResetUnit();
          break;
        case '#': //evaluate password
          DoorCheck();
          break;
        default: //append any keypress that is not a '*' nor a '#' to the currently guessed password.
          password.append(keyP);
          LitUp.append(keyP);
          currentLength++;

          //Print some feedback.
          Serial.print("Enter password: "); // debug
          digitalWrite(Blight, HIGH);
          lcd.setCursor(3, 0);
          lcd.print("Enter Code:");
          lcd.setCursor(6, 1);

          for (byte i = 0; i < currentLength; i++)
          { //adding * for each entry
            Serial.print('*');
            lcd.print("*");
          }
          Serial.println("Entry");
      }
      if (currentLength > maxLength) // if more than the chosen password length is entered
      {
        Serial.print("Overflow"); //debug
        lcd.clear();
        digitalWrite(Blue, HIGH);
        lcd.setCursor(4, 0);
        lcd.print("Too many");
        lcd.setCursor(4, 1);
        lcd.print("entries!");
        delay(1000);
        lcd.clear();
        lcd.setCursor(3, 0);
        lcd.print("Resetting");
        ResetUnit();
        delay(800);
        lcd.clear();
      }
    }
  }
  TimerCheck();
}

// Flash the led during an event
void BlueFlash()
{
  for (int q = 0; q < 2; q++)
  {
    digitalWrite(Blue, HIGH);
    delay(150);
    digitalWrite(Blue, LOW);
    delay(150);
  }
}

// Check the passwords
void DoorCheck()
{
  lcd.clear();
  Serial.print("Evaluated"); //debug
  if (LitUp.evaluate()) // if light code entered
  {
    BlueFlash();
    digitalWrite(Blight, HIGH);
    lcd.clear();
    lcd.setCursor(3, 0);
    lcd.print("Let There");
    lcd.setCursor(4, 1);
    lcd.print("Be Light");
    digitalWrite(Lights, LOW);
    LtTime = millis();
    Light = !Light;
    currentLength = 0;

  }
  if (password.evaluate()) //if entry code entered
  {
    digitalWrite(Blue, HIGH);
    digitalWrite(Green, LOW);
    lcd.setCursor(4, 0);
    lcd.print("Correct!");
    Serial.print("Yes"); // debug
    digitalWrite(Relay, LOW); // open sesame
    currentLength = 0;
    Magnet = !Magnet;
    MagTime = millis();
  }
  //record that # has been pressed
  EvalTime = millis();
  Evaluated = !Evaluated;
  //right or wrong clear password arrays
  password.reset();
  LitUp.reset();
}

void TimerCheck()
{
  // turn the magnet back on after 1 sec
  if (Magnet && millis() - MagTime >= 1000)
  {
    Magnet = !Magnet;
    digitalWrite(Relay, HIGH);
    digitalWrite(Green, HIGH);
    digitalWrite(Blue, LOW);
  }
  // lights stay on for five minutes
  if (Light && millis() - LtTime >= 300000)
  {
    digitalWrite(Light, HIGH);
    Light = !Light;
  }
  //turn off message after 5 secs
  if (Evaluated && (millis() - EvalTime > 3000))
  {
    lcd.clear();
    digitalWrite(Blight, LOW);
    Evaluated = !Evaluated;
  }
}

//reset the nano when things get weird
void ResetUnit()
{
  digitalWrite(Blight, HIGH); // Backlight on
  lcd.setCursor(3, 0);
  lcd.print("Resetting");
  lcd.setCursor(2, 1);
  lcd.print("Please Wait");
  BlueFlash();
  Serial.print("reset"); //debug
  delay(200);
  digitalWrite(Reset, LOW);
}

Dolok2501.timertweak.V1.ino (4.89 KB)

No worries, just mixed up quote with code, sorry.
tried to highlight comments in code, turns out formatting doesnt carry. will fix when can.
No faults from IDE, just no outputs from LED when its expected.
Thanks

jokerphun:
EDIT: should mention that the RGB is a common positive (Anode?) with a 1k res between it and 5V

Hello jokerphun,

Wrong! You should have 3 series resistors, one each for r, g & b. You say red may be damaged. Blue and Green wiill need approximately the same resistor, perhaps 220R.

Paul

Well that solved it. Thanks! Needed a new RGB with new resistors each.