Help wanted. How can I change variables with s
Kai-
Here's one approach. Use pulldown resistors (~47 KOhms) on
each of I/O 0, I/O 1, I/O 2, I/O 3, then a switch on each to
+5 Volts. Set switches for desired value with code like:
a = IN0 + ( 2*IN1 ) + ( 3*IN2 ) + ( 4*IN3 )
FOR level = 0 TO 255 Step a 'a is the variable I will change
PWM Pin1,level,25
gosub delay
NEXT
Or, to save variable ("a" not used) and code space:
FOR level = 0 TO 255 Step ( IN0 + ( 2*IN1 ) + ( 3*IN2 ) + ( 4*IN3 ) )
PWM Pin1,level,25
gosub delay
NEXT
Regards,
Steve
On 26 Sep 02 at 7:50, Kai Kuehle wrote:
> Hello.
>
> Help wanted.
> I am a newcomer.
> Please show me anybody how I can change variables with switches.
> Like this:
>
> a var byte
> a = 1
>
> How I can change the variable a with a switch? (from 1 to 10)...
Here's one approach. Use pulldown resistors (~47 KOhms) on
each of I/O 0, I/O 1, I/O 2, I/O 3, then a switch on each to
+5 Volts. Set switches for desired value with code like:
a = IN0 + ( 2*IN1 ) + ( 3*IN2 ) + ( 4*IN3 )
FOR level = 0 TO 255 Step a 'a is the variable I will change
PWM Pin1,level,25
gosub delay
NEXT
Or, to save variable ("a" not used) and code space:
FOR level = 0 TO 255 Step ( IN0 + ( 2*IN1 ) + ( 3*IN2 ) + ( 4*IN3 ) )
PWM Pin1,level,25
gosub delay
NEXT
Regards,
Steve
On 26 Sep 02 at 7:50, Kai Kuehle wrote:
> Hello.
>
> Help wanted.
> I am a newcomer.
> Please show me anybody how I can change variables with switches.
> Like this:
>
> a var byte
> a = 1
>
> How I can change the variable a with a switch? (from 1 to 10)...