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

0 Members and 4 Guests are viewing this topic.

Offline cypressx1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +0/-0
    • View Profile
Re: Controlling external hardware through Lua
« Reply #15 on: July 15, 2011, 09:09:22 am »
Really good job.

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 #16 on: July 15, 2011, 01:21:44 pm »
Answer to Netham45:
The stuff that took so long to type was: 'while 1 do led("I") sleep(1) led("<3") sleep(1) led("Omnimaga") sleep(3) end'.
Its not the most easy thing to do while filming the whole thing, and typing with one hand ;)

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Controlling external hardware through Lua
« Reply #17 on: July 15, 2011, 01:50:23 pm »
Holy cow!
Amazing, Jim! :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 #18 on: July 17, 2011, 11:55:22 am »
In case anyone wants it, you can find the Lua and the C (for the arduino) source code here: http://bwns.be/jim/arduino-ti.zip

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Controlling external hardware through Lua
« Reply #19 on: July 24, 2011, 05:09:38 pm »
In case anyone wants it, you can find the Lua and the C (for the arduino) source code here: http://bwns.be/jim/arduino-ti.zip

Arduino takes Processing as code :P Not C? Or can it also take C? I'm pretty sure it's Processing though.

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 #20 on: July 25, 2011, 01:29:02 am »
Well, its Processing, but I think its valid C anyway :p

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Controlling external hardware through Lua
« Reply #21 on: July 25, 2011, 07:53:07 am »
Well, its Processing, but I think its valid C anyway :p

It's Processing then, and save it as .pde, not as .c :P

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Controlling external hardware through Lua
« Reply #22 on: July 28, 2011, 12:41:12 pm »
This is a bit off topic, but if you can control external hardware, can you also control external files on the calculator?

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 #23 on: July 28, 2011, 01:05:48 pm »
If you mean files on the local calculator, you can access libraries with Lua.
If you mean something like an sdcard, no, because we can't get yet hardware input .
There is though a chance that you can connect an sdcard to the dock, but more research has to be done on it.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Controlling external hardware through Lua
« Reply #24 on: July 29, 2011, 11:47:42 am »
I meant can you get data from other lua files on the local calculator (i.e. level data, high scores, etc.)?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Controlling external hardware through Lua
« Reply #25 on: July 29, 2011, 12:06:25 pm »
I know I'm a bit late, but wow.  That video is epic. :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 #26 on: July 29, 2011, 12:33:26 pm »
Thanks :D

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Controlling external hardware through Lua
« Reply #27 on: July 30, 2011, 01:11:02 am »
I meant can you get data from other lua files on the local calculator (i.e. level data, high scores, etc.)?

Not really, the data has to be in the same .tns file, and then get retrieved with var.recall, which grabs a Maths activity variable and puts in in a Lua variable
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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 #28 on: July 30, 2011, 01:19:40 am »
Adriweb, you can also use math.eval to execute a function in a library document (not in the current tns file) and return stuff saved there.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Controlling external hardware through Lua
« Reply #29 on: July 30, 2011, 01:29:01 am »
yep, but I think that if you have a lot of calculations to do, importing the variables in Lua then do all your calculations within lua (and then var.store() the final result) is much faster than doing all the calculations in a math.eval() call, as it's calling the math 'server' (as they call it) everytime ...

EDIT : but I think it's fine if you have only a few calculations to make
« Last Edit: July 30, 2011, 01:29:21 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation