Trying to make a clock with nano

Hi, I wrote this very simple sketch to create a clock for a project. It compiles and uploads. I have done similar things before and these worked. Now nothing happens.

void setup() 
{
  // put your setup code here, to run once:

  pinMode(5, OUTPUT);

}

void loop() 
{
  // put your main code here, to run repeatedly:
digitalWrite(5, HIGH);
delay(25);
digitalWrite(5, LOW);
delay(25);
}

Cant see what Ive done wrong.
Update:
Aha, I was using physical pin numbers rather than digital.

1. You mean Stop Watch or Normal Clock?

2. Are yo getting 1sec time tick from millisCounter or from a RTC like DS1307 or DS3231?

3. Where do you want to show time -- on Serial Monitor or 7-segment Display Unit or LCD or on OLED?

Your code generates a 20Hz square wave on pin 5. (As expected.)

2 Likes

Thanks I found the problem. I was using physical pin number instead of digital.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.