Hello,
I am trying to toggle an output with a simple pushbutton. For 1 input/output the switchmacro works, but for the second one it just passes the macro.Or is there a better solution?
Thanks.
problem with avr waituntil
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
- Contact:
Re: problem with avr waituntil
Hello Ikke,
The only problem with the program is the parameters being used in the WaitUntil macros.
The WhichSwitch(Byte) parameter refers to the position of the monitored switch within the port byte (0 to 7). This can be a calculated value to provide flexibility, but your program requires the constant values 0 and 1 in branches for the corresponding inputs.
The only problem with the program is the parameters being used in the WaitUntil macros.
The WhichSwitch(Byte) parameter refers to the position of the monitored switch within the port byte (0 to 7). This can be a calculated value to provide flexibility, but your program requires the constant values 0 and 1 in branches for the corresponding inputs.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: problem with avr waituntil
Don't know if this will help.
This is how I controlled o/p that is toggled each time i/p goes high. It does not wait for a switch to be pressed before carrying on, program is constantly looping so other functions can be performed. While switch is pressed, program doe not continue until switch is released, to avoid rapid nuisance toggling . Note: Using var = var XOR 0b00000001 will also toggle.
This is how I controlled o/p that is toggled each time i/p goes high. It does not wait for a switch to be pressed before carrying on, program is constantly looping so other functions can be performed. While switch is pressed, program doe not continue until switch is released, to avoid rapid nuisance toggling . Note: Using var = var XOR 0b00000001 will also toggle.
Martin