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

#BlockWhat it doesDropdown optionsWhat the options mean
1setupIRreceive PIN# 2 Socket Type NEC_8 docallback functionSets up the IR receiver on a pinSocket Type: NEC_8, NEC_16, NEC_other, RC5Choose the IR protocol your remote uses
2IRreceive get command codeReads data from the IR signalcommand, address, raw, pulsesChoose what part of the signal to read β€” command is most common
3IRreceive PauseTemporarily stops receivingPause, RecoverPause = stop listening, Recover = start listening again
4IRreceive whether receive new dataChecks if a new signal was receivedβ€”Returns true if a new command came in
5IRreceive timeout 2000 msSets how long to wait for a signalβ€”If no signal comes in during this time, it times out
6callback with: cmd, addr, raw, pulsesDefines what to do when a signal is receivedβ€”You can use the received data to trigger actions
7println cmd addr raw pulsesPrints the received IR dataβ€”Great for debugging or learning what your remote sends

πŸ”Ί IR Sending Blocks

#BlockWhat it doesDropdown optionsWhat the options mean
8setupIRsend PIN# 2 Socket Type NEC power 100%Sets up the IR transmitterSocket Type: NEC, Samsung, RC5Choose the protocol your target device understands
9IRsend command code 0 address code 0 control bit 0Sends a full IR signalβ€”You define the command, address, and control bit manually
10IRsend pulses code [9000,4500,563,563]Sends a custom pulse patternβ€”Advanced use β€” great for mimicking unknown remotes
11IRsend raw code 0x1234Sends a raw hexadecimal signalβ€”Use this if you know the exact code to send
12whether the ir transmission is CompleteChecks 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