Author Topic: Controlling external hardware through Lua  (Read 16983 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #30 on: July 30, 2011, 01:32:50 am »
Yeah, that is very true :)

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Controlling external hardware through Lua
« Reply #31 on: July 31, 2011, 03:10:16 pm »
That looks great, I wish I was as skilled with external hardware, as it looks to be quite interesting! :D


Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #32 on: August 02, 2011, 01:48:13 am »
Thanks apcalc :)

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Controlling external hardware through Lua
« Reply #33 on: February 18, 2012, 02:47:57 am »
jimbauwens, may be you would be interested by a native Lua extension for this, without the original print() limitations?
Ndless.me with the finest TI-Nspire programs

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #34 on: February 18, 2012, 04:38:23 am »
ExtendeD, you don't know how much I was researching after I heard the news :D
The thing is with the file functions in os.h I can read/write to the serial port (uber awesome). But when reading stdin, it will block until there is data.
And since I can not check if there is data some way, I can't use this method.
There are two possibilities for me:
1) Directly talk to the serial hardware
2) Make stdin non blocking

2 can be done with fcntl() (from fcntl.h), and since it's a posix function it might be in the Nspire. But finding it is another task ^^.

If you have suggestions, please post them :D

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Controlling external hardware through Lua
« Reply #35 on: February 18, 2012, 07:53:02 am »
You should try low-level serial port access, it shouldn't be too difficult.
Ndless.me with the finest TI-Nspire programs

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #36 on: February 19, 2012, 09:02:25 am »
Okay, I'll look at that.
But I have another question: is the method of reading the serial port the same on CX and classic?
(Since they use other uart hardware)

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: Controlling external hardware through Lua
« Reply #37 on: February 19, 2012, 10:37:21 am »
No, they use different registers.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #38 on: February 19, 2012, 02:14:57 pm »
Okay, thanks for the information.
When I got some time I'll try to use this method.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Controlling external hardware through Lua
« Reply #39 on: February 19, 2012, 02:30:24 pm »
Sound via Ndless is possible, right?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #40 on: February 19, 2012, 02:35:51 pm »
Yes, it is :)
And now we can create modules that make it possible in Lua (and even better quality!) :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Controlling external hardware through Lua
« Reply #41 on: February 19, 2012, 02:37:18 pm »
Ok that's good to hear then. I wonder, since the processor is 150 MHz, if you could have sound as complex as this?



Or even midi-based sound like in Doom?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Controlling external hardware through Lua
« Reply #42 on: February 19, 2012, 02:41:46 pm »
Maybe, but I'm not sure.
Right now I don't have time to make a player, but if no one else does it, I'll make one.