Communicate

IR Communicate

πŸ”΄ IR – Communicate – Your “Programmable Remote Control”

What it does: Sends and receives infrared signals.

Send: Control TVs, air conditioners

Receive: Read existing remote controls

Β 

🧩 Fun Guide to IR Communication Blocks (Clu-blocks Pro)

πŸ“‘ Important! IR blocks let your robot send and receive invisible light signals β€” just like a remote control. You can use it to control devices, react to button presses, or even talk to other robots!


πŸ”» IR Receiving Blocks

# Block What it does Dropdown options What the options mean
1 setupIRreceive PIN# 2 Socket Type NEC_8 docallback function Sets up the IR receiver on a pin Socket Type: NEC_8, NEC_16, NEC_other, RC5 Choose the IR protocol your remote uses
2 IRreceive get command code Reads data from the IR signal command, address, raw, pulses Choose what part of the signal to read β€” command is most common
3 IRreceive Pause Temporarily stops receiving Pause, Recover Pause = stop listening, Recover = start listening again
4 IRreceive whether receive new data Checks if a new signal was received β€” Returns true if a new command came in
5 IRreceive timeout 2000 ms Sets how long to wait for a signal β€” If no signal comes in during this time, it times out
6 callback with: cmd, addr, raw, pulses Defines what to do when a signal is received β€” You can use the received data to trigger actions
7 println cmd addr raw pulses Prints the received IR data β€” Great for debugging or learning what your remote sends

πŸ”Ί IR Sending Blocks

# Block What it does Dropdown options What the options mean
8 setupIRsend PIN# 2 Socket Type NEC power 100% Sets up the IR transmitter Socket Type: NEC, Samsung, RC5 Choose the protocol your target device understands
9 IRsend command code 0 address code 0 control bit 0 Sends a full IR signal β€” You define the command, address, and control bit manually
10 IRsend pulses code [9000,4500,563,563] Sends a custom pulse pattern β€” Advanced use β€” great for mimicking unknown remotes
11 IRsend raw code 0x1234 Sends a raw hexadecimal signal β€” Use this if you know the exact code to send
12 whether the ir transmission is Complete Checks if sending is done β€” Returns true when the signal has finished transmitting

🧠 Quick Tips for Students

  • Use setupIRreceive before trying to read signals β€” it’s like turning on the ears.
  • Use command code to get the button press β€” most remotes send this.
  • Use callback functions to make your robot react instantly β€” like turning on a light when you press a button.
  • Use IRsend to control TVs, fans, or other IR devices β€” just match the protocol and code.
  • Use println to discover what your remote sends β€” then reuse those codes to send them back!
On this page