Help with irin command

lstrike

New Member
I am using the irin command in my project and would like some help.

A segment of my project's code looks like this:

nomad:
irin c.2, b0
select case b0
case 18
high b.2, b.5
low b.3, b.4
end select
goto nomad

When I use the code, it works, but the command latches it in that position unless another key is pressed. I would like to make it so that the variable(b0) resets (goes from 18 to 0) once the button is released.
 

neiltechspec

Senior Member
How about -

Code:
nomad:
	b0 = 0
	
	irin c.2, b0
	
	select case b0
	 case 18
	  high b.2, b.5
	  low b.3, b.4
	end select
	
	goto nomad
 

hippy

Ex-Staff (retired)
You can also use the timeout feature of IRIN to jump to other code if no IR command is received.
 

hippy

Ex-Staff (retired)
I know about the timeout command, but am unsure of how to use it in my code.
You need to choose a time after which no IR received will cause some action to be taken, and specify the code to handle that. Something like ...

Code:
nomad:
  b0 = 0
  irin [b][PLAIN][1000,noir][/PLAIN],[/b] c.2, b0
  select case b0
   case 18
    high b.2, b.5
    low b.3, b.4
  end select
  goto nomad

[b]noir:
  <do things when no ir received>
  goto nomad[/b]
 

rossko57

Senior Member
It just latched that part on.
Could you expand on what you'd like to happen?
Having set the output pins, nothing in your code would ever change the output pins state. Do you want the pins to change back when button released?
Having got into the 'goto nomad;' loop, nothing in your code will ever jump out of that (but perhaps there is some interrupt driven code we can't see). Do you want to leave this loop after the button has been pressed, or if it is not pressed within some time?
 
Top