Skip to content

twrackers/FastClock-sketches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastClock-sketches

This is a collection of Arduino sketches which run as "fast clocks" used in model railroading.

FastClock_QnD

This sketch is a minimal "quick and dirty" fast-clock code which uses the delay() function for timing and the Arduino IDE's Serial Monitor for output. Note that the use of the delay() function causes the timing of the main loop() function to lag a bit because the runtime of the non-delay portion is unknown.

FastClock_NoDelay

This sketch improves the "quick and dirty" version by eliminating the call to the delay() function and using a call to millis() instead. This is equivalent to the difference between the IDE example sketches Blink and BlinkWithoutDelay. This change makes the timing as accurate as the Arduino's millisecond-clock. The clock output is still written to the Serial Monitor.

FastClock_Stateful

This sketch replaces timing code in the .ino file with calls to a StateMachine object to encapsuate the timing logic. Again, the clock output is written to the Serial Monitor.

FastClock

This sketch replaces output to serial with one of several small external displays. Which one is used is selected by uncommenting one of several #include lines near the top of the FastClock.ino file. At this time, each of the supported displays would be connected to the microcontroller with a Qwiic I2C interface. The Adafruit Metro Mini is one such processor board.

Header file Display Default address Used address
Adafruit_LED.h Adafruit 7-Segment Backpack 0x70 0x77
SparkFun_Alphanumeric.h SparkFun Qwiic Alphanumeric Display 0x70 0x70
SparkFun_OLED.h SparkFun Qwiic - OLED - (1.3in., 128x64) 0x3D 0x3D

About

Sketches to create model-railroad "fast clocks".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages