Picaxe project request

Thread Starter

happysoul

Joined Sep 9, 2014
28
Hi all
could anyone help me with a small picaxe project, i need to have a event input either hi or low that triggers and output flashing LED that flashers until a reset is given.
thanks
 

Papabravo

Joined Feb 24, 2006
21,225
What kind of help do you need? Do you need some help with the circuit or do you need help with the programming? Which specific picaxe are we talking about? Can you provide a link? What have you done so far?
 

Thread Starter

happysoul

Joined Sep 9, 2014
28
yeah i thought i could use 2 * 555 or 556 one as a trigger and the other as the flasher but the picaxe would be smaller and easier
 

wayneh

Joined Sep 9, 2010
17,498
I think you could use just one 555, enabled or not. But I was just making sure you were aware and it sounds like you are.
 

elec_mech

Joined Nov 12, 2008
1,500
Here is something to play with. You'll need a pull-down resistor on C.1 and C.2 to keep the inputs low when no signal is present.

Did you build the 100 LED Push Button project?

Code:
#picaxe 08m2                           ' Define PICAXE 08M2
#no_data                               ' Ignore EEPROM data - loads program faster

'========================================================================

Initialize:                            ' Initialize Routine - initialize pins and set up variables
    LET dirsC = %00001000              ' Make pin C.3 a output; rest as inputs
    LET pinsC = %00000000              ' Turn off all outputs on port C
    SYMBOL IN = C.1                    ' Define C.1 (pin 6) as IN to indicate input signal
    SYMBOL RST = C.2                   ' Define C.2 (pin 5) as RST to indicate reset switch
    SYMBOL LED = C.3                   ' Define C.3 (pin 4) as LED to indicate LED light
    SYMBOL i = b0                      ' Data byte variable used with reset button command
    LET i = 0                          ' Set i equal to 0
    SYMBOL pulse_high = b1             ' Data byte variable used to set pulse high time
    LET pulse_high = 500               ' Set pulse_num equal to 500 (milliseconds)
    SYMBOL pulse_low = b2              ' Data byte variable used to set pulse low time
    LET pulse_high = 500               ' Set pulse_num equal to 500 (milliseconds)

'========================================================================

Main:                                  ' Main Routine
    IF IN = 1, THEN DoIt               ' If IN (input pin) is high, then go to DoIt routine
GOTO Main                              ' Go to Main routine

'========================================================================

DoIt:                                  ' DoIt Routine
    HIGH LED                           ' Turn on LED
    PAUSE pulse_high                   ' Wait for pulse_high time
    BUTTON RST,1,255,0,i,1,CLR         ' If reset button is pressed, go to CLR routine
    LOW LED                            ' Turn off LED
    PAUSE pulse_low                    ' Wait for pulse_low time
    BUTTON RST,1,255,0,i,1,Main        ' If reset button is pressed, go to main routine
GOTO DoIt                              ' Go to DoIt routine

'========================================================================

CLR:                                   ' CLR Routine
    LOW LED                            ' Turn off LED
GOTO Main                              ' Go to Main routine

'========================================================================

END                                    ' End program
 

Thread Starter

happysoul

Joined Sep 9, 2014
28
Hi elec mech thanks for the post, ill give it a try, with regards to the 100 led project we have had a few budget problems so i have everything but the switches, but i still want to build it, ill let you know as soon as i get the bean counters to come up with the money.
thanks again
 

elec_mech

Joined Nov 12, 2008
1,500
Sorry, forgot C.3 can only be used as an input on the 08M2. Try this:

Code:
#picaxe 08m2                           ' Define PICAXE 08M2
#no_data                               ' Ignore EEPROM data - loads program faster

'========================================================================

Initialize:                            ' Initialize Routine - initialize pins and set up variables
    LET dirsC = %00010000              ' Make pin C.3 a output; rest as inputs
    LET pinsC = %00000000              ' Turn off all outputs on port C
    SYMBOL IN = pinC.1                  ' Define C.1 (pin 6) as IN to indicate input signal
    SYMBOL RST = C.2                   ' Define C.2 (pin 5) as RST to indicate reset switch
    SYMBOL LED = C.4                   ' Define C.3 (pin 4) as LED to indicate LED light
    SYMBOL i = b0                      ' Data byte variable used with reset button command
    LET i = 0                          ' Set i equal to 0
    SYMBOL pulse_high = b1             ' Data byte variable used to set pulse high time
    LET pulse_high = 500               ' Set pulse_num equal to 500 (milliseconds)
    SYMBOL pulse_low = b2              ' Data byte variable used to set pulse low time
    LET pulse_high = 500               ' Set pulse_num equal to 500 (milliseconds)

'========================================================================

Main:                                  ' Main Routine
    IF IN = 1 THEN DoIt                ' If IN (input pin) is high, then go to DoIt routine
GOTO Main                              ' Go to Main routine

'========================================================================

DoIt:                                  ' DoIt Routine
    HIGH LED                           ' Turn on LED
    PAUSE pulse_high                   ' Wait for pulse_high time
    BUTTON RST,1,255,0,i,1,CLR         ' If reset button is pressed, go to CLR routine
    LOW LED                            ' Turn off LED
    PAUSE pulse_low                    ' Wait for pulse_low time
    BUTTON RST,1,255,0,i,1,Main        ' If reset button is pressed, go to main routine
GOTO DoIt                              ' Go to DoIt routine

'========================================================================

CLR:                                   ' CLR Routine
    LOW LED                            ' Turn off LED
GOTO Main                              ' Go to Main routine

'========================================================================

END                                    ' End program
 

elec_mech

Joined Nov 12, 2008
1,500
In both BUTTON commands, change the 1 after RST to 0 as shown below. I'm not 100% this is it - I need to see a schematic of your circuit, specifically the reset button (N.O. or N.C.) and whether you are using a pull-up or pull-down resistor on the PICAXE pin. Based on your description thus far, I assume a N.O. (normally open) switch and a pull-up resistor on the PICAXE pin and the other end of the switch connected to ground.

Code:
BUTTON RST,0,255,0,i,1,Main        ' If reset button is pressed, go to main routine
 

Thread Starter

happysoul

Joined Sep 9, 2014
28
Thanks that did the trick, its for a warning indicator for a pump in a seller, i only have a three wire cable running up to the house so i needed the reset to be low and that way i could share the negative with the reset and the led.
 
Top