How to get the IR Codes that Codey Rocky Receives


#1

Hi, I’m trying to rfind the way how to recieve any IR signal on Codey from physilcal remotes.
Test to send command from Codey to Codey works, but not from other devices.
I tried my Pillips TV remote, other IR remote from toys, Androir IR Transmitter, Android apps - no luck.
I tried build-in infrared commands and IR extension - no luck.
Maybe the key is special IR commands coding?
Please help.


#2

@goodillla The code would look something like this:

image

Try that code and see if it works. It uses the two button shown below:

If you mean that you want to send a specific code or receive a specific code and do something with it (e.g., show it on the screen), that is currently impossible with blocks. I’ll look into a micro-python workaround and see what I can do, but I doubt anything will happen. :confused:

Thanks for your time,
Best_codes


#3

Thanks for reply, but as I said I already tried this, doesn’t work.
The remote itself works, I tried different remotes and different buttons like on/off, Volume+, still no.
I need the way to debug in python
I tried this:

import codey, event, time

@event.button_c_pressed
def on_button_c_pressed2():
a = codey.ir.learn(time_s = 3)
codey.display.show(a)

And got “None”, like recieved nothing.


#4

@goodillla I have no issues recording the signal from IR with codey, but I also can’t get it to print the code it is receiving on the screen. I don’t have many ideas, but I’ll see if later this week I can test some stuff out on my Codey. :light_smile:

The docs you mentioned are a good reference, I hadn’t found them yet. I’ll read through them and see what I can discover. Good luck!


#5

Update:
I found the documentation here - https://makeblock-micropython-api.readthedocs.io/en/latest/codey&rocky/codey/IR.html

import codey
import event

@event.start
def start_cb():
print(“start event succeeded”)
while True:
codey.display.show(codey.ir.receive_remote_code()[1])

And got success - only one of my toy’s remote works and now I see it’s values.
But TV’s remotes no.

Looks like Codey can recieve IR not from every remote.


#6

Great! I’ll check that out. I’m not sure why it would work on a TV remote…

Tip: format your code using the ``` symbols:

import codey
import event

@event.start
def start_cb():
print(“start event succeeded”)
while True:
codey.display.show(codey.ir.receive_remote_code()[1])

@goodillla


#7

@goodillla Try a code like this:

import codey
import time

while True:
    ir_data = codey.ir.receive()
    print(ir_data)
    time.sleep(1)

and this code might work, too (Press button C):

@event.button_c_pressed
def button_c_cb():
    print("button c event succeeded")
    while True:
        codey.display.show(codey.ir.receive()) 

Good luck!


#8

With this code now I see the codes of pressed buttons in realtime even from android apps.
Thats nice and gives wide opportunity to control Codey, so I can go forward to make smth with that.
So thanks.

btw, how can I share my programs in public ?


#9

@goodillla I’m glad the code worked for you! As for sharing your codes in the public, you can always use the mBlock community to share them (you’ll have to make a project).

You can also always share your codes on GitHub (github.com) or email them to me and I can share them on my site.
https://the-best-codes.github.io/?forum

Happy coding and good luck with your codey! Mention me as @Best_codes if you need help with anything else. :slight_smile:


#10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.