Can you pass the variable of INFRAIN to another variable?

erdc

Member
I get a syntax error in this code which is just suppose to set low the last pin that was received via infrain, and set high the pin that infrain is currently been sent.

main:
infrain
if infra = 1 then light1on
if infra = 2 then light2on
goto main

light1on: high 1
low OLD_INFRA
let OLD_INFRA = infra ' ERROR Mistake on this line
goto main

Edited by - erdc on 23/05/2006 22:19:00
 

ljg

New Member
I tried this variant of your code and it compiles for an 18X

symbol oldinfra = b6

main:
infrain
if infra = 1 then light1on
if infra = 2 then light2on
goto main

light1on: high 1
low oldinfra
let oldinfra= infra ' ERROR Mistake on this line
if infra = 1 then light1on
goto main

light2on:
goto main
 

tarzan

Senior Member
Try this:

<code><pre><font size=2 face='Courier'>main:

infrain

let pins = infra min 1 max 2

goto main </font></pre></code>
 

tarzan

Senior Member
Ok that didn't work but this will.

<code><pre><font size=2 face='Courier'>main:

infrain

if infra = 1 then Light_0n1 'pin0
if infra = 2 then Light_0n2 'pin1

goto main


Light_0n1:

let pins = infra


goto main

Light_0n2:


let pins = infra


goto main </font></pre></code>

Edited by - tarzan on 24/05/2006 12:18:11
 

tarzan

Senior Member
<A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=3432&amp;forum_id=19&amp;Topic_Title=Infra%2B%252D%2Bextra%2Bbyte%2Bvariable%2Bon%2B18x%253F&amp;forum_title=No+new+posts+please%21+13' Target=_Blank>External Web Link</a>infra variable
 

erdc

Member
OK, got it to work. It now turns off (LOW) the last infra, and turns on (HIGH) the current infra.

Thanks Larry for your input! Funny thing to watch for is, if you send a infra value of 125, the next interation it will try to LOW port 125.

Edited by - erdc on 25/05/2006 01:06:39
 

ljg

New Member
Glad you worked it out.

Be aware that the INFRAIN command only works for values between 1 and 17, and returns junk for anything else. I suspect it isn't working with all the available bits in the INFRA variable.

If you need the full spectrum of Phillips codes, you'll need to get an 08M and use the INFRAIN2 command.
 
Top