Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
While True
If Switch = 1 Then [B]Sub[/B] LED1
EndIf
If Switch2 = 1 Then [B]Sub[/B] LED2
EndIf
Wend
Device = 18F2550
Clock = 20
// some LCD options...
#option LCD_DATA = PORTB.4 // Assign the LCD connections
#option LCD_EN = PORTB.3 //
#option LCD_RS = PORTB.2 //
// import LCD library...
Include "LCD.bas"
Include "utils.bas"
Include "convert.bas"
Dim Var1 As Word
Dim LED As PORTA.0 // Assign an alias for "LED"
Dim LED2 As PORTA.1 // Assign an alias for "LED2"
Dim Switch As PORTA.2, // Assign an alias for "Switch"
Dim Switch2 As PORTA.3, // Assign an alias for "Switch2"
//subs
Sub Debounce()
DelayMS(10) // Small delay to stop "bouncing"
While Switch = 1 // Wait for the switch to be de-pressed
Wend //
End Sub
Sub LEDA()
LED = 1
DelayMS 100
LED = 0
DelayMS 100
End Sub
Sub LEDB()
LED2 = 1
DelayMS 100
LED2 = 0
DelayMS 100
End Sub
// Start Of Program...
SetAllDigital // Make all pins digital I/O's
Input(Switch) // Make the switch pin an input
Low(LED) // Make the LED an output and set it Low
Input(Switch2) // Make the switch1 pin an input
Low(LED2) // Make the LED2 an output and set it Low
DelayMS(150) // Let the LCD warm up
Cls // Clear the LCD screen
WriteAt(1,1,"test") // Send some text to the LCD
DelayMS(1000)
WriteAt(2,1,"test")
DelayMS(1000)
WriteAt(3,1,"Input function test")
DelayMS(1000)
WriteAt(4,1."2 input, 2 output")
While True
If Switch = 1 Then LEDA
EndIf
If Switch2 = 1 Then LEDB
EndIf
Wend