Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Lua IR?

                  
   
  1. #1
    PSP User
    Join Date
    Jun 2006
    Location
    Under your bed (H)
    Posts
    377
    Rep Power
    67

    Default Lua IR?

    in lua is there IR so I can send signals?

    edit: whoops, im stupid, i just found out there is >_<

  2. #2
    PSP Coder -Xandu-'s Avatar
    Join Date
    Jan 2007
    Posts
    1,036
    Rep Power
    79

    Default

    IrDA functions in Lua:

    nil System.irdaInit()

    Opens the IrDA device. Call this to start the IrDA module.

    System.irdaWrite(string)

    Writes the string to the IrDA port.

    string System.irdaRead()

    Reads all available data from the IrDA port. Returns an empty string, if no data was received.

  3. #3
    PSP User
    Join Date
    Jun 2006
    Location
    Under your bed (H)
    Posts
    377
    Rep Power
    67

    Default

    I used irdacapture on my remote control for my helicopter, but it came back with like loads of symbols and it doesnt work in Lua, Hoe would I be abnle to figure out what the symbols mean?
    if pad:up() then
    if System.irdaWrite("Ԅ||8N|||t.| |>8N|||||䄄|||||||||> .||䄄|䄄䄀 ||8䄄|䄀|䄄||pĄ|䄄8|䄄|䄈 ||<䄄|N|䄄|N|||| |䄄 ||||p|8<8䄄| |Є||pЄ||p|||||| ||||||䄄|䄄|N||| ||N䄄||| 䄄|||䄄|䄄||䄀||䄄|䈀| 䄀|||䄄|||||||8N||||| |p|NpȄ|䄄|~||<||||.> |||>|||>|||||||| |䄀䄀||䄀|䄄||䄄|||||| |||.|||||.|||||/8䄄 ||||>||||/||||||||||||䄐|||||| ||||") then
    screen:print(0,40,"Going UP!",white)
    end
    that is what I have, but it doesn't say "Going UP!".

  4. #4
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Arrow

    The symbols are bytes outside of the normal range
    of printable characters. It looks like your helicopter
    uses byte values between 128 and 255 fo take off. U'll
    need a hex file reader to see the exact values.
    (PSP Filer has a hex reader)
    I posted a similar program written in lua a while back in
    THIS THREAD- to print raw data
    reads from Irda to the PSP screen in decimal

  5. #5
    PSP Coder -Xandu-'s Avatar
    Join Date
    Jan 2007
    Posts
    1,036
    Rep Power
    79

    Default

    I've been thinking about coding an IRLearner, but I don't think I'll release that in public though.

  6. #6
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default

    to get the Irda write statement working, you can
    convert the data to decimal byte escape sequences in Lua: \ddd
    eg. to output 2 bytes 0x01 0xff , use System.irdaWrite("\1\255")

  7. #7
    PSP User
    Join Date
    Jun 2006
    Location
    Under your bed (H)
    Posts
    377
    Rep Power
    67

    Default

    Where would I find the 0xff or whatever they are called?

  8. #8
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default

    Where would I find the 0xff or whatever they are called?
    think the capture prog sends all its 0xff 's to a file in the root ms0:/
    open the file from Lua , then read the string.byte(s)

    *edit* the code is like:
    PHP Code:
    System.irdaInit()
    codes=io.open("ms0:/capture.dat","rb")
    System.irdaWrite(codes:read("*a"))
    codes:close() 

  9. #9
    PSP User
    Join Date
    Jun 2006
    Location
    Under your bed (H)
    Posts
    377
    Rep Power
    67

    Default

    I don't see any file in my mem stick called capture.dat.

    edit: u mean the other thread ircapture. yes i have a file called "ircapture" so I work on it

    edit2: How would I get a file 1 char at a time? because string.byte() only works on 1 letter rather than a line of it

  10. #10
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default

    umm, yeah, Ive D/L'd the prog now; the file paths
    "ms0:/irdacapture".

    to read bytes into a table:
    PHP Code:
    codes io.open("ms0:/irdacapture","rb"
    Byte,i={},0
    repeat
    i
    =i+1
    Byte
    [i]=string.byte(codes:read(1))
    until not Byte[i]
    codes:close() 
    to transmit Byte[n] to the helicopter:
    PHP Code:
    System.irdaWrite(string.char(Byte[n])) 
    to write Byte[n] to screen:
    PHP Code:
    screen:print(10,10,tostring(Byte[n]),Color.new(255,0,0)) 

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •