Go Down

Topic: Cannot blink pins 7 through 5 (NEWBIE) (Read 1 time) previous topic - next topic

crosson

Hi Everyone,

I am trying to make a binary clock to help facilitate my learning of electronics and of the Arduino.

Give my code here, I am unable to blink my HOUR pins.
Code: [Select]
int const MINUTES[] = {13, 12, 11, 10, 9, 8};
int const HOURS[] = {7, 6, 5};
int const delayms = 1000;
int const up_to = 60;

void setup() {               
  // initialize digital pins as outputs.
  for(int led = 5; led < 14; led++){
    pinMode(led, OUTPUT);
  }
  Serial.begin(9600);
}


void blink_binary_number(int number, int const pin_array[], boolean vol=HIGH){
  for(int led = 0; led < number; led++){
    if (bitRead(number, led) == 1){
      digitalWrite(pin_array[led], vol); //Here we use our PINS array to decide which LED to blink. Since I wanted 13 to be bit 0, 12 bit 1, etc...
    }
  }
}

void loop() {
  int hours = 1;
for(int x = 0; x < up_to; x++){
   
   Serial.println(x);
   //Serial.println(hours);
   
   //blink_binary_number(hours, HOURS);
   blink_binary_number(x, MINUTES);
   delay(delayms);
   //blink_binary_number(hours, HOURS, LOW);
   blink_binary_number(x, MINUTES, LOW);
   
   if (hours < 13) {
     hours++;
   } else {
    hours = 0;
   }
}
}


Here is a picture of my board. Pins 5,6,7 being the back 3 pins. For now I just wired up 3 but I'll need 4 to at least count to 12 obviously. I hadn't proceeded that far since I can't get any of these 3 to blink.

Picture

crosson

Even if I load the example file Blink.ino I cannot blink those pins

HazardsMind

Try analogWrite, you might have burned out your arduino.
Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

PeterH

I haven't looked into the logic you're using to control the writes, but at first glance it's complex enough that I'm not certain whether you are actually doing a digitalWrite(HIGH) on the relevant pins. Write a sketch that does nothing but set the mode to output and set the pins HIGH, disconnect all the external wiring and just connect one LED with a current limiting resistor to each output pin in turn, with the other leg of the LED grounded.
I only provide help via the forum - please do not contact me for private consultancy.

crosson


Try analogWrite, you might have burned out your arduino.


I'll give that a shot. All the other pins continue to blink fine.

Go Up