Can you help me
Jimm2
Posts: 16
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 LEDPin1 = 0 LEDPin2 = 18 SwitchPin = 23 Var long LastSwitchChange long RateThreshold long LastCNTValue long ResultCNT byte SwitchStatus Pub start Dira[noparse][[/noparse]LEDPin1]~~ Dira[noparse][[/noparse]LEDPin2]~~ Dira[noparse][[/noparse]SwitchPin]~ RateThreshold := 100_000_000 LastCNTValue := cnt repeat ResultCNT := cnt - LastCNTValue if Ina[noparse][[/noparse]SwitchPin] <> SwitchStatus 'is the state of the switch different from the last time it changed? LastCNTValue := cnt 'lets record this time SwitchStatus := Ina[noparse][[/noparse]SwitchPin] 'store this as the current switch status if ResultCNT > RateThreshold 'we have gone over our threshold with no change in the SwitchStatus 'this means either the switch was held down or not pressed outa[noparse][[/noparse]LEDPin1]~ If SwitchStatus == 1 'Switch was held outa[noparse][[/noparse]LEDPin2]~~ else 'switch was not pressed outa[noparse][[/noparse]LEDPin2]~ else 'the switch is changing faster than the threshold rate outa[noparse][[/noparse]LEDPin1]~~ 'ADD THIS TO THE PROGRAM UP THERE.......... PUB Turn dira[noparse][[/noparse]4..9] := %111111 outa[noparse][[/noparse]4..9] := %111111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %011111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %001111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %000111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %000011 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %000001 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %000000 PUB Down dira[noparse][[/noparse]4..9] := %111111 outa[noparse][[/noparse]4..9] := %111111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]4..9] := %000000
What I want is, To hold down (pin23 switch) and outa [noparse][[/noparse]4..9] led's will come on. That same (pin23 switch) if I were to hit it on and off, on and off, on and off- It will make outa [noparse][[/noparse]4..9] (it will go 4 5 6 7 8 9).
That's all.......................