{{ ************************************ * demo_pushbutton_led * * 2008 Michael St.Onge * ************************************ Goal: Use a button to light an LED when pressed. Purpose: This will demonstrate the use of "ina" to sense an I/O button, then use "outa" on another pin to light an LED. }} CON _clkmode = xtal1 + pll16x ' Feedback and PLL multiplier _xinfreq = 5_000_000 ' External oscillator = 5 MHz LED = 0 ' LED Output Pin PUSHBUTTON = 1 ' Pushbutton Input Pin PUB ButtonBlinkSpeed ' Main method dira[LED]~~ ' Set pin to output repeat ' Endless loop if ina[PUSHBUTTON] == 1 ' If pushbutton pressed outa[LED]~~ ' Turn on the LED else ' If pushbutton not pressed outa[LED]~ ' Turn off the LED