// https://wokwi.com/projects/346778138320044627

// Fri 28 Oct 16:03:11 UTC 2022

// Blink an LED, over and over ('endless loop')

void LED_ON() {
  digitalWrite(LED_BUILTIN, 1);
}

void LED_OFF() {
  digitalWrite(LED_BUILTIN, 0);
}

// ON_TIME  200     OFF_TIME  1000

//  WEIGHT    5     UNIT_TIME    4
//   SCALE   50

#define WEIGHT 5 // OFF to ON ratio (time intervals)
                 // larger WEIGHT gives more OFF time
#define UNIT_TIME 4 // basis of all other timings
#define SCALE 50 // scales all times evenly

#define ON_TIME (UNIT_TIME * SCALE)
#define OFF_TIME (ON_TIME * WEIGHT)

void report() {
  Serial.println("\n The red LED is marked 'L' on the Uno.");
  Serial.println(" This program makes it blink.");

  Serial.print("\n Your ON_TIME: ");
  Serial.print(ON_TIME);
  Serial.print("    Your OFF_TIME: ");
  Serial.println(OFF_TIME);
  Serial.println("");
}


void LED_BLINK () {
  LED_ON();
  delay(ON_TIME);
  LED_OFF();
  delay(OFF_TIME);
}

void setup_GPIO() {
  pinMode(LED_BUILTIN, OUTPUT);
  LED_OFF();
}

void setup_serial() {
  Serial.begin(9600);
}

void setup() {
  setup_GPIO();
  setup_serial();
  report();
}

void loop() {
  LED_BLINK();
}

// END.
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5