"Touch" command - adjust the brightness on LED

Mejlby

Member
Hello all

Is there anyone who can help with a program where i can use "Touch" command to turn up or turn down the brightness on LED.

It should appear so:

As long I touch the "touch-button" adjustable brightness slowly down to the desired level and when I touch again adjust brightness slowly up again

I will look forward to hearing from anyone

Tonny
 

eclectic

Moderator
Hello all

Is there anyone who can help with a program where i can use "Touch" command to turn up or turn down the brightness on LED.

It should appear so:

As long I touch the "touch-button" adjustable brightness slowly down to the desired level and when I touch again adjust brightness slowly up again

I will look forward to hearing from anyone

Tonny
A quick question.

One button for both functions?

Or two buttons; one up and one down?

e
 

hippy

Ex-Staff (retired)
Start by implementing the functionality required using a normal push button on an input, then replace that with code which determines if the touch is activated or not.
 

Mejlby

Member
I know well TOUCH command-but I do not know how to make the program to adjust the brightness
maybe you have an idea ?
 

Mejlby

Member
No, I am not familiar with Pwmout

I have read in the manual and try it on PICAXE Editor - but it makes no sense to me. what is possible with this ?
 

inglewoodpete

Senior Member
Attach a LED with current limiting resistor to the PWM output of your PICAXE and experiment with the duty cycle in your PWMOut or PWMDuty command. This will change the proportion of the "on" time of each cycle and thus the brightness of the LED.
 

Mejlby

Member
Hello inglewoodpete

Thanks for your help - now I can adjust the brightness on an LED
BUT .... Now I want the program to stop the program when the brightness is in the level as i vant and start again from the code line from where it left off when i pres on again
maybe you have a suggestion when you see the program

should I use gosub Commando?

Yes ..... I am a newbie
 

Attachments

Last edited:

westaust55

Moderator
When you press the button, you could enter a loop until the button is released.
As pseudo code:

Code:
symbol direction = b5

Testinput:
If button not pressed then testinput
Toggle direction

DO
; change on time by an increment here - direction indicated whether longer or shorter change
Pause 100
LOOP UNTIL button =released
GOTO testinput
[code]
 
Last edited:
Top