Name:
irin
Syntax:

IRIN pin, variable

IRIN [timeout], pin, variable

IRIN [timeout, address], pin, variable

Timeout - is a variable/constant which sets the timeout period in milliseconds

Address - is a label which specifies where to go if a timeout occurs

Pin - is a variable/constant which specifies the i/o pin to use

Variable - receives the data

Description:

Wait until a new infrared command is received. This command is similar to the infrain2 command found on other PICAXE devices, but can be used on any input pin. This command is used to wait for an infraout signal from a separate PICAXE chip. It can also be used with an infrared signal from the infrared TV style transmitter (i.e. can replace infrain). All processing stops until the new command is received, but after a timeout period program flow will jump to 'address'. The value of the command received is placed into the defined variable. This will be a number between 0 and 127.

Start Data0 Data1 Data2 Data3 Data4 Data5 Data6 ID0 ID1 ID2 ID3 ID4
2.4ms 1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms
1.2 or
0.6ms

To replace an infrain / infrain2 command with irin use these two lines:

       symbol infra = b13
  irin C.0, infra

Effect of Increased Clock Speed:

This command will automatically use the internal 4MHz resonator for correct operation.

Values received from the TVR010 remote control

TVR010 TV
Remote Control
irout command infrain variable
data value
irin variable
data value
1 irout pin,1,0 1 0
2 irout pin,1,1 2 1
3 irout pin,1,2 3 2
4 irout pin,1,3 4 3
5 irout pin,1,4 5 4
6 irout pin,1,5 6 5
7 irout pin,1,6 7 6
8 irout pin,1,7 8 7
9 irout pin,1,8 9 8
P+ irout pin,1,16 10 16
0 irout pin,1,9 11 9
V+ irout pin,1,18 12 18
P- irout pin,1,17 13 17
10+ irout pin,1,12 14 12
V- irout pin,1,19 15 19
MUTE irout pin,1,20 16 20
PWR irout pin,1,21 17 21
Applies To:
08M2, 14M2, 18M2, 20M2, 20X2, 28X1, 28X2, 40X1, 40X2
See Also:
Related Create:
Share:
Print:

Read an IR Remote button push

Read an IR signal from the sensor on input C.3 with button 2 (value 1) turning on output B.1 and button 5 (value 4) turning output B.1 off

Code Example:
main:	irin [1000,main],C.3,b0	; wait for new signal
	if b0 = 1 then swon1	; switch on 1
	if b0 = 4 then swoff1	; switch off 1
	goto main

swon1:	high B.1
	goto main
swoff1:	low B.1
	goto main
Copy Code Submit an Example

Show which key pressed

This example reports which key has been pressed on a remote control. The key code of the key pressed is shown on the 'terminal' display of the Programming Editor which is shown after download by inclusion of the #terminal command. Use "#terminal 4800" for M2 devices. Use "#terminal 9600" for X2 devices

Code Example:
	#terminal 4800				; Use the terminal for display

main:	irin C.3, b0				; Read IR key press
	sertxd( "Key code = ", #b0, cr, lf )	; Report which key was pressed

	goto main				; Repeat
Copy Code Submit an Example

Submit Your Own Code!

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

Comments

  • Login to leave a comment.