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.
Device = 18f242
Clock = 20
Include ("utils.bas")
Dim S1 As PORTB.5
Dim S2 As PORTB.4
Dim LED1 As PORTA.5
Dim LED2 As PORTB.3
Dim LED3 As PORTC.0
Dim LED4 As PORTA.3
SetAllDigital
Output (LED1)
Output (LED2)
Output (LED3)
Output (LED4)
LED1 = 1
LED2 = 1
LED3 = 1
LED4 = 1
While 1 = 1
LED1 = S1
LED2 = S2
Toggle (LED3)
DelayMS(500)
Wend
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 4/2/2013 *
* Version : 1.0 *
* Notes : *
* : *
*****************************************************************************
}
Device = 18f2420
Clock = 20
include "utils"
dim stateold as byte
dim state as byte
dim led1 as portc.0
dim led2 as portc.1
dim led3 as portc.2
dim led4 as portc.3
SetAllDigital
input (portb.0)
input (portB.1)
output (led1)
output (led2)
output (led3)
output (led4)
state = 0
stateold = 0
//while true
state = portb
stateold = (state and $FF)
if stateold = 0 then
portc =%00000001 // tells us no switches are on
endif
if stateold = $3 then
portc =%00000010 // tells us both switches are on
endif
if stateold = $1 then
portc =%00000100 // tells us switch sw1 is on sw2 is off
endif
if stateold = $2 then
portc =%00001000 // tells us that switch sw2 is on sw1 is off
endif
//wend
LOL we now no how to pass a high on a input to a output nice LOL. Jon is your head hurting from the left side.
I hope your not referring to my code it's fully functional if you can hook a pic 18f2420 up with a crystal 20 mhz and place 4 leds on the lower port of portC and hook the tilt sensor on portb 0 and 1.unfunctional software
I hope your not referring to my code it's fully functional if you can hook a pic 18f2420 up with a crystal 20 mhz and place 4 leds on the lower port of portC and hook the tilt sensor on portb 0 and 1.
Yes I understand its really not designed to sense tilt....