Name:
infrain
Syntax:

INFRAIN

Description:

This command is deprecated, please consider using the irin command instead.

This command is primarily used to wait for a new infrared signal from the infrared TV style transmitter. It can also be used with an infraout signal from a separate PICAXE chip. All processing stops until the new command is received. The value of the command received is placed in the predefined variable 'infra'. The infra-red input is input 0 on all parts that support this command. See also infrain2. The variable 'infra' is separate from the other variables. After using this command you may have to perform a hard reset to download a new program to the microcontroller.

Effect of Increased Clock Speed:

This command will only function at 4MHz.  Use a setfreq m4 command before this command if using 8MHz speed.

Use of TVR010 Infrared Remote Control

The table shows the value that will be placed into the variable 'infra' depending on which key is pressed on the transmitter. Before use (or after changing batteries) the TVR010 transmitter must be programmed with 'Sony' codes as follows:

1. Insert 3 AAA size batteries, preferably alkaline.

2. Press 'C'. The LED should light.

3. Press '2'. The LED should flash.

4. Press '1'. The LED should flash.

5. Press '2'. The LED should flash and then go out.

Key Value
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
P+ 10
0 11
V+ 12
P- 13
10+ 14
V- 15
Mute 16
Power 17
Applies To:
18A, 18X, 28, 28A, 28X, 40X
See Also:
Related Create:
Share:
Print:

Receive an IR remote control button push

Wait for an IR button push then set or clear outputs depending on the button pushed

Code Example:
main:	infrain				;wait for new signal
	if infra = 1 then swon1 	;switch on 1
	if infra = 2 then swon2 	;switch on 2
	if infra = 3 then swon3 	;switch on 3
	if infra = 4 then swoff1 	;switch off 1
	if infra = 5 then swoff2 	;switch off 2
	if infra = 6 then swoff3 	;switch off 3
	goto main

swon1:	high 1
	goto main
swon2:	high 2
	goto main
swon3:	high 3
	goto main
swoff1:	low 1
	goto main
swoff2:	low 2
	goto main
swoff3:	low 3
	goto main
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.