Newbie in trouble

afacuarius

New Member
Hi, I'm doing my first picaxe projects, I am slowly climbing some level, my first projects were on and off a LED and went up the complexity of my projects.
I have seen some basic commands, but not how to write them

I finished this that I show, but now I want to change the DIP SW by a single push button, which when squeezed, change the strings.

At this time, for a sequence, I move to 1 output interutor as 4 effects are different, are 4 switches. I want to summarize all this interrumpor only push 1 botom that when pressed, switch to the next routine.
I'm using the picaxe 18m2

I hope to understand and I use google translator

Many Thanks for the help

regards


Hola, estoy realizando mis primeros proyectos con picaxe, estoy subiendo poco a poco a poco de nivel, mis primeros proyectos fueron prender y apagar un led y fui subiendo la complejidad de mis proyectos.
he visto algunos comandos basicos, pero no se como escribirlos

he terminado este que les muestro, pero ahora quiero cambiar el DIP SW por un solo push boton, que al apretarlo, cambie las secuencias.

En este momento, para tener una secuencia, debo mover a 1 el interutor de la salida, como son 4 efectos diferentes, son 4 interruptores. todo esto lo quiero resumir a 1 solo interrumpor push botom que al presionarlo, cambien a la siguiente rutina.
estoy utilizando el picaxe 18m2

Espero me de a entender ya que uso el traductor de google

Muchas Gracias por la ayuda

Saludos

Code:
b1 = 80
b2 = 175
b3 = 400
b4 = 90
b5 = 400
b6= 25


inicio:

if input0 is on then bala 'si la entrada 0 es "1" salta a subrutina bala sino a inicio
if input1 is on then balb 'si la entrada 1 es "1" salta a subrutina balb sino a inicio
if input2 is on then balc 'si la entrada 2 es "1" salta a subrutina balc sino a inicio
if input6 is on then bald 'si la entrada 6 es "1" salta a subrutina bald sino a inicio


goto inicio 'salto a inicio


bala: `entrada a

high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
low 0,1,2
pause b1
high 0,1,2
high 0,1,2
pause b1
low 0,1,2
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5
low 3,4,5
pause b1
high 3,4,5
high 3,4,5
pause b1
low 3,4,5




balb: `entrada b

high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 5
pause b2
low 5
high 0
pause b2
low 0
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5
high 0,1
pause b3
low 0,1
high 4,5
pause b3
low 4,5





balc: `entrada c

high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
high 0,1,2,3,4,5
pause b1
low 0,1,2,3,4,5
low 0,1,2,3,4,5
pause b1
high 0,1,2,3,4,5
low 0,1,2,3,4,5





bald: `entrada d

low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 2,3
pause b6
high 2,3
high 2,3
pause b6
low 2,3
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 1,4
pause b6
high 1,4
high 1,4
pause b6
low 1,4
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5
low 0,5
pause b6
high 0,5
high 0,5
pause b6
low 0,5

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3

low 2,3
pause b6
high 2,3

high 2,3
pause b6
low 2,3


low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4


low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 0,5
pause b6
high 0,5

high 0,5
pause b6
low 0,5

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

low 1,4
pause b6
high 1,4

high 1,4
pause b6
low 1,4

pause b5


goto inicio 'salto a inicio

[video=youtube_share;b8ujfZLwO7o]http://youtu.be/b8ujfZLwO7o[/video]
 
Last edited:

westaust55

Moderator
Since you are using a new PICAXE part, the 18M2 it would be good to use the IO pin naming convention recommended for the newer parts with the port.pin scheme.
See the pinout diagram here: http://www.picaxe.com/Site_Resources/Media/Site_1/pinout/pinout18m2.jpg

So your four inputs may be C.0, C.1, C.2 and C.3

Your outputs may be B.0, B.1, B.2, B.3, B.4 and B.5

If I understand correctly you wish to remove the 4-switch DIL switch and use a single push button switch to advance through the LED lighting sequences.

With a single input you can use a scheme such as the following
IF <pin> is on THEN ; (this is the same as IF <pin> = 1 THEN)
INC <variable>
<variable> = <variable> //4 ; for 0,1,2,3,0,1,2,3 as a repeating sequence
Waitfor release:
IF <pin> is on THEN Waitforrelease ; loop until the switch is released
GO <variable> GOTO bala, balb, balc, bald


for <variable> use any available byte variable such as b0, b1, b2, etc
for <pin> assign one of the existing input pins such as pinC.0, pinC.1, etc
 

afacuarius

New Member
thanks for the reply

Most of the information I have obtained on picaxe is in Spanish, the way I've learned this well as I put it, but you're right, because you can reach a particular point where they can not understand if you do not follow the rules settings according to the scheme

Start, modifies my code, according to the scheme, starting from there, I'll get to study your suggestions.

based on this, I have another question, according to how I raise, by eliminating the dip sw, just press you a push button to make the change, but doing so will only be momentary high (1) the stop pushing (0) and only make 1 time routine, the idea is to continuously follow the routine, even to press the push botom to make the following, I hope you understand me

regards


gracias por la respuesta

La mayor parte de la informacion que he obtenido sobre picaxe esta en español, la manera que he aprendido esta asi como la he puesto, pero tienes razon, ya que puede llegar un punto en particular en donde no puedan entenderme si no sigo las reglas de configuracion de acuerdo al esquema

de inicio, modificare mi codigo, de acuerdo al esquema, partiendo de ahi, me pondre a estudiar tus sugerencias.

en base a esto, tengo otra pregunta, de acuerdo a como me lo planteas, al eliminar el dip sw, solo presionare un push boton para realizar el cambio, pero al hacerlo, solo sera momentaneo un alto (1) el dejar de presionar (0) y solo hara 1 vez la rutina, la idea es que siga continuamente la rutina, hasta volver a presionar el push botom para que efectue la siguiente, espero me de entender

saludos
 

westaust55

Moderator
You can also consider using interrupts (see the SETINT command) as a means of detecting the push button operation at any time.
When a push button is pressed the program branches to the Interrupt: subroutine that would increment the LED sequence routine number - that is INC <variable> - and then return to the next instruction in the current subroutine.

If you do not need to change to the new LED light sequence immediately and can wait for the current sequence to complete, a small looping main routine can be used to control which LED lighting sequence to execute again and again forever. Then when the new variable value is encountered you automatical branch to the new LED sequence at that time.

If you need to quickly start the new LED lighting sequence then you can put some tests into each LED lighting sequence to regularly test for a change in the sequence number. When a new value is encountered, the program can immediately branch to the start of the new sequence.

I trust this description makes some sense for you to understand.
 
Top