forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IR Question

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Mr Billy



Joined: 26 Oct 2005
Posts: 10

PostPosted: Sat Nov 26, 2005 2:17 pm    Post subject: IR Question Reply with quote

i love the new ir function, i was playing around with it and its pretty neat. i was wondering tho, can i read the command that a button on my tv remote is sending, and send that command to do stuff with my tv. i know its just a pulse rate on the LED and not really a command, but is there a way to do it this way? thanx
_________________
"There is no spoone"
-The Matricks
Back to top
View user's profile Send private message
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Sat Nov 26, 2005 2:35 pm    Post subject: Reply with quote

nope, Ive tried this with simple C programs, too many variables. You can recieve the IR and display them, acording to what I see in the source.

EDIT
Alright, I used my modified .11 and I can make it do what my C program did!

Quote:
print("")
System.irdaInit()
while true do
input = Controls.read()
if input:start() then break end
irtext = System.irdaRead()
if irtext ~= "" then
print(irtext)
end
end


put that in an index.lua and run it, it will recieve the IR signal and print it on the screen.

NOTE: the print() function uses teh debug library, which uses a different text encoding, so dont try the screen:print(), all it does it print letters that look like static.
Back to top
View user's profile Send private message AIM Address
Mr Billy



Joined: 26 Oct 2005
Posts: 10

PostPosted: Sat Nov 26, 2005 3:16 pm    Post subject: Reply with quote

what if i made a program to count the number of milliseconds between inputs, and output every x milliseconds. it really wouldnt matter what character is outputted, just so it lights up the LED. that could work theoretically, right?

EDIT: I made a program to do this and i counted 17 milliseconds between pulses on my TV power button on my remote. im going to try to output any character once every 17 milliseconds to see if it will turn it on.

EDIT2: Doesnt work... how do all these other programs made in C do it? like the one that controlls a phillips TV...
_________________
"There is no spoone"
-The Matricks
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Nov 26, 2005 5:39 pm    Post subject: Re: IR Question Reply with quote

Mr Billy wrote:
i was wondering tho, can i read the command that a button on my tv remote is sending, and send that command to do stuff with my tv.


There are 3 infrared modes for PSP: IrDA (see http://forums.ps2dev.org/viewtopic.php?t=2555 for an example program in C, which I've used as the base for the Lua Player implementation), SIRCS for Sony remote controls (see http://forums.ps2dev.org/viewtopic.php?p=17336#17336 for some oscilloscope pictures of the signal) and custom mode for other remote controls (see http://forums.ps2dev.org/viewtopic.php?t=3140 for the nice hack from PspPet). IrDA is implemented in Lua Player, SIRCS and general IR is on the TODO list at http://wiki.ps2dev.org/psp:lua_player:todos

As it is already implemented I have to provide some nice Lua API for it, only and copy and paste the implementations. Do you have some ideas how the Lua functions for SIRCS and general IR should look like?
Back to top
View user's profile Send private message
Mr Billy



Joined: 26 Oct 2005
Posts: 10

PostPosted: Sat Nov 26, 2005 6:03 pm    Post subject: Re: IR Question Reply with quote

As it is already implemented I have to provide some nice Lua API for it, only and copy and paste the implementations. Do you have some ideas how the Lua functions for SIRCS and general IR should look like?[/quote]

i honestly have no idea how they should look, im new to the whole IR thing. since i dont have wifi in my house (i live in a cave :P) this is the closest thing i have to wireless communications. i cant wait til i can interface my psp with my laptop or control my tv, vcr, dvd player, and surround with my psp.

and a little tip to anyone that likes to see what their IR LED is doing... use your webcam. most digital cameras and webcams pick up ir, so you can see it if u need.
_________________
"There is no spoone"
-The Matricks
Back to top
View user's profile Send private message
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Sun Nov 27, 2005 2:21 am    Post subject: Re: IR Question Reply with quote

Shine wrote:
As it is already implemented I have to provide some nice Lua API for it, only and copy and paste the implementations. Do you have some ideas how the Lua functions for SIRCS and general IR should look like?


Well, for SIRCS don't you have to convert the signal to HEX, then switch numbers, then do more confusing stuff?

I think if your going to put it in, make it like the 3D stuff where its the same command, and maybe include some instructions on how to get the numbers for it.
Back to top
View user's profile Send private message AIM Address
aldebaran



Joined: 17 Nov 2005
Posts: 12

PostPosted: Wed Nov 30, 2005 8:57 pm    Post subject: Re: IR Question Reply with quote

youresam wrote:
Well, for SIRCS don't you have to convert the signal to HEX, then switch numbers, then do more confusing stuff?

I think it is a general sistem to obtain IR codes from any remote controller.
Sony, for an example, encodes each command as an AGC burst (2400picoseconds) followed by a 7-bit command field and a 5-bit device field transmitted lsb (last significant bit) to msb (most sb). A "0" bit is encodes as 600 picosec idle followed by a 600 picosec pulse; while a "1" bit is encodes as 600 picosec idle followed by a 1200 picosec pulse.
Starting from the HEX code you read, you can generate (with a script) almost every other code for your device (without saving each signal).

Another point is: I don't know if there is a filter in front of the IR diod (like the Newton MP2100 has) which can prevent the PSP to read ir signals with a frequency different from ~ 40 KHz (Sony frq).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group