Macro....kinda

killer skittle

New Member
:confused: okay im kinda new here....sorry for the "noob-ness"! i wanted to know how to do simple picaxe recording where you have a button as an input, you press another button like record. then you press it like 3 or how ever many times and you press play and it will blink a led (on the same input/output) how ever many times you pressed the record button and like how fast or slow? is it possible...i have a picaxe 14m that ive been messing around with...THESE THINGS ARE SOOO COOL! :eek:
thx,
-nick-
 
Last edited:

Dippy

Moderator
So, I press 'record' button.
Then I press another button x times.

Do, I release the 'record' button to say 'stop recording'?
Or do I press 'record' again to say stop recording?

Then I press 'playback' and it flashes an LED x times and with the same time delays in between flashes as there was in the 'recording' session.

Is that right?

Have you made any attempts to do this?
Yes, within reason, PICAXE can do this.
Are you expecting someone to write all the code for you?
Is it a school project for which we all gain marks? :)
 

killer skittle

New Member
So, I press 'record' button.
Then I press another button x times.

Do, I release the 'record' button to say 'stop recording'?
Or do I press 'record' again to say stop recording?

Then I press 'playback' and it flashes an LED x times and with the same time delays in between flashes as there was in the 'recording' session.

Is that right?

Have you made any attempts to do this?
Yes, within reason, PICAXE can do this.
Are you expecting someone to write all the code for you?
Is it a school project for which we all gain marks? :)
1. either one it doesnt matter, i just want a little help getting a ROUGH code...but other than that you are right!

2. hardware- yes ive made a couple attempts
2a. as far as code goes only a little bit, ive gotten macros and stuff recorded by the computer...NOT by the picaxe itself

3. no not expecting anyone to write the code for me, maybe a little push tho!

4. unfortunately ive graduated so no more school for me!
 

lbenson

Senior Member
>unfortunately ive graduated

Not many put it that way. You can always go back for more.

Start with simple code which you can test in the simulator (you can probably do your whole project in the simulator). Read a button press (pin goes high), turn on an LED. Release (pin goes low), then turn off LED.

Next try timing. When you detect a second button press, go into a loop until you detect a release. Inside the loop, increment a count and do "pause 10". When the button is released, the count will be of the number of 10 millisecond pauses. Then turn on an LED, perform a "for" loop using the count, and pause 10 milliseconds within the loop. When the loop ends, turn off the LED. Repeat as desired. Use multiple counts for multiple button-press timings.

This will roughly provide the structure for whatever you want to do.
 
Last edited:

killer skittle

New Member
@ lbenson - i have done that kind of stuff, but now im trying to make a "standalone picaxe" that will record inputs and play them back in the order i originally did them....is that possible? does the picaxe have like a small RAM that will remember things untill its reset or powered off?
:confused:
 

eclectic

Moderator
@K-S
The latest version of Manual 2
is your best reference for your project.

Some relevant pages are;
10
83-85
88-90
114-115
146
215

amongst others.

Enjoy the journey in Picaxe-land. Seriously.

e
 

boriz

Senior Member
Code:
‘pseudo code

main
Do
Loop until record button pressed

‘start recording
Illuminate recording LED
Do
	Increment button_up_time
	If button pressed,
		Store button_up_time in ram_pointer location
		Do
			Increment button_down_time
			Pause 10
		Loop until button released
		Increment ram_pointer
		Store button_down_time in ram_pointer location
		Increment ram_pointer
	Else
		Pause 10
Endif
Loop until record button pressed

‘stop recording
Extinguish recording LED
This should help to get you started. You'll have to crate the 'playback' routine on your own :)
 

lbenson

Senior Member
>does the picaxe have like a small RAM that will remember things untill its reset or powered off?

Not only does it have that, it also has eeprom which will remember even when the power is turned off. Different picaxes have different amounts of storage just as they have different numbers of inputs and outputs.

Boriz's code should be enough to get you started in the simulator (part of the Programming Editor). Try it and see what you come up with. If you get a syntax error, check Manual 2 to see how the command should be stated.
 

boriz

Senior Member
@Ibenson

It's pseudo code. Never intended as a program. The simulator will puke on almost every line. More like a rough sketch of a skeleton. It will need fleshing out considerably. A working routine would have at least twice as many lines! I see no profit in trying it in the simulator.
 
Top