My First Lines of Code

A short walk down memory lane to see my first lines of code written in BASIC just to make an LED blink for a simple little hello world.

My First Lines of Code

Technically I had played around with coding before this point, but this was the first time I solidly coded and the beginning of what would become my career.

All through high school I took electronics classes mostly full of resistors, switches, and LEDs. It wasn't until later that coding was introduced to us and I had an incredibly supportive teacher to whom I credit for getting me into my career. (By chance I was able to give back as I got to work with him professionally after graduating university.)

It was this teacher in February 2008 that gave each of us a development board which had LEDs, piezoelectric speaker, and headers for the ATmega32L chip.

A very 2008 looking photo of the development board.

We crimped and soldered our own serial ports, which often broke due to poor manufacturing and abuse, and connected those to Windows XP computers.

A blurry hand made F-tier quality serial port cable.

On these Windows XP machines, we used BASCOM AVR IDE to write BASIC for the chip.


And in this I present, pretty much the first piece I code I wrote. While the file was templated nicely for us - it was my first hand written "hello world" by toggling an LED on and off in section 12:

' 1. Title Block
' Author: Niko Uusitalo
' Date:
' File Name: flash1Led.bas
' 2. Program Description:
'    This program will use the not function to turn an LED on
' 3. Hardware Features:
'    The LED is connected to PORT B
' 4. Program Features
'    An LED will turn on and off
' 5. Compiler Directives (these tell Bascom things about our hardware)
$crystal = 8000000                      'the speed of the micro
$regfile = "m32def.dat"                 'our micro, the ATMEGA32
' 6. Hardware Setups
' setup direction of all ports
Config Porta = Output                   'LEDs on portA
Config Portb = Output                   'LEDs on portB
Config Portc = Output                   'LEDs on portC
Config Portd = Output                   'LEDs on portD

' 7. Hardware Aliases
Led Alias Portb.3                       

' 8. initialise ports so hardware starts correctly

Porta = &B11111111
Portb = &B11111111
Portc = &B11111111
Portd = &B11111111
' 9. Declare Constants
Const Ontime = 350                    
Const Offtime = 100
' 10. Declare Variables

' 11. Initialise Variables

' 12. Program starts here

   Led = Not Led
   Waitms Ontime

' 13. Subroutines

' 14. Interrupt service routines (isr)

From here we moved to messing with:

  • More LEDs (turning them on and off in a Knight Rider style)
  • Dot matrixes
  • LCDs
  • Piezos (for six months+ someone was always playing the Barbie Girl midi)
  • Switches
  • Photoresistors
  • And more misc. components
Knight Rider.

Growing up I had always wanted to do something in science or technology, but taking this class back in 2008 four times a week really shaped my future. It's incredible to still have these files and the memories from way back when I was a completely novice programmer. 👀 But don't let my job title fool you, I'll always be ready to learn as a novice.