XC8 Code for an dual alternating flasher (not the person in a trench coat) – AKA Model Train Level Crossing Lights.

The LED is hooked up to PortA.0 and PortA.1  The code and include files can be found here in GitHub – https://github.com/JamieStarling/MCU_FUN/tree/master/Microchip/PIC10F322  alternating_flasher.c

#include "includes/10F322_deviceconfig.h"
#include "includes/gpio.h"

void main ()
{
  
    
    pinMode(0,OUTPUT);
    pinMode(1,OUTPUT);
    
    //The Forever Loop
    while (1)
    {
        
        //Set PortA.0 High (turn on LED)
        digitalWrite(0,ON);   
        digitalWrite(1,OFF); 
        
        //Wait 1 second
        __delay_ms(1000);
        
        //Set PortA.0 Low  (turn off LED)
        digitalWrite(0,OFF);
        digitalWrite(1,ON);
        
        //Wait 1 second
        __delay_ms(1000);
        
        //End of Loop
        
    }
}