Goal: Make an LED blink in a continuous loop
Purpose: This will demonstrate the use of the “dira” to set pin to an output state, and then use “outa” to turn on the LED.
Clock frequency: 5,000 Hz
Propeller code type: This propeller code is based on spin language only.
Files to download: (right click)
Pics to Download: (click to enlarge)
{{
************************************
* demo_repeat_blink_led *
* 2008 *
************************************
Goal: Make an LED blink in a continuous loop
Purpose: This will demonstrate the use of the "dira" to set pin to an output state,
and then use "outa" to turn on the LED.
}}
CON
_clkmode = xtal1 + pll16x ' Feedback and PLL multiplier
_xinfreq = 5_000_000 ' External oscillator = 5 MHz
pinLED = 0 ' assign which pin the led is on
PUB Blinker ' Main method
dira[pinLED]~~ ' Set pin to output (~ sets I/O to input
and ~~ sets I/O to output, all pins default to input state)
repeat ' Endless loop
!outa[pinLED] 'toggles output of pin low/high (if low,
then high, or if high, then low)
waitcnt(clkfreq / 4 + cnt) ' Wait 1/4 second -> 2 Hz (uses the clock
frequency of 5 MHz)

