Push Button Input

Bozambo

Member
For the longest while I have been struggling with this project. Namely:
Getting input pin 3 on 08m2 to light four LEDs in turn when ever a push button switch attached to it is pressed.
That is to say; On first press pin 0 should go high and remain high
On second press Pin 1 should go high and remain on as well.
On the third press Pin2 should be high and remain high.
Then cycle back.to repeat process

I have tried using procedures but to no avail.
Any insights on how this can be achieved would be greatly appreciated.

Bo
 

hippy

Technical Support
Staff member
Perhaps post your code then people can take a look at it and advise where you may be going wrong.

The following is one way to do it ...

Code:
#Picaxe 08M2

MainLoop:
  Do
    Low  4 : Low  2 : Low  1 : High 0 : Gosub WaitForPush
    Low  4 : Low  2 : High 1 : Low  0 : Gosub WaitForPush
    Low  4 : High 2 : Low  1 : Low  0 : Gosub WaitForPush
    High 4 : Low  2 : Low  1 : Low  0 : Gosub WaitForPush
  Loop

WaitForPush:
  Pause 20 : Do : Loop Until pin3 = 0
  Pause 20 : Do : Loop Until pin3 = 1
  Return
 

Bozambo

Member
I do appreciate the effort to assist but just two considerations.
1. All my work is being done with logicator flow chart.
2. When the respective LEDs light they are supposed to remain on until reset.

I have included a copy of what I have done thus far.
 

Attachments

Last edited:

Technoman

Senior Member
Hi,

It is not clear to me about the cycle : can you have every output high at the same time?
Is it cycling down to 0,0,0,0 (see down here) ?

0,0,0,1
0,0,1,1
0,1,1,1
1,1,1,1
1,1,1,0
1,1,0,0
1,0,0,0
0,0,0,0
 
Top