Getting Started

A short overview for beginners with microcontrollers and/or the programming language Luna.

Equipment

Installation

  1. Download the archive with the actual LunaAVR development environment.
  2. Just unpack the archive and save the folder with all files on a place of your choice. The LunaAVR development environment can also be started from USB-stick. There is no need for an installation with changes on your system; therefore an installation-program is not necessary. With unpacking and copying the files to the place of your choice the installation is done. If desired, a shortcut on your desktop can be created easily (e.g. for Windows OS: Select the LunaAVR symbol and drop it on your Windows Desktop while holding the „ALT“ key.

First Start & Setting

After starting the program „LunaAVR“ adjust the setting for ide-programmer-uploader.

Other settings are at the moment not required, we are now ready to start programming.

A Luna program requires a minimum of three definitions:

  1. What microcontroller should be used („device“)
  2. What clock rate is given by fusebit and hardware (e.g. quartz) („clock“)
  3. Stack size („stack“) - What does stack mean?

Learn more: Root class Avr

Example for an empty correct program:

avr.device = atmega168
avr.clock  = 8000000
avr.stack  = 32
 
halt()


Another simple program, an LED connected to PortB.0 (Pin 14) is flashing:
Learn more: #Define, Port-pins of the microcontroller und Wait, Waitms, Waitus

avr.device = atmega168
avr.clock  = 8000000
avr.stack  = 32
 
#define LED1 as portB.0   'LED1 is defined as label for portB.0
LED1.mode = output,low    'the port is configured as output and set to low
 
do
  LED1 = 1                'switch LED1 on
  waitms 500              'wait for 500ms
  LED1 = 0                'switch LED1 off
  waitms 500              'wait for 500ms
  'alternatively for the commands above also following commands can be used
  'LED1.toggle            'toggle the actual status of the port pin
  'wait 1                 'wait for 1 second
loop