I am looking for example in lua that show how to connect two modem, and send data from one modem UART to the second modem UART.
In my final product i will need to connect one modem(as client) to two modem(serve as servers) and this connections need to stay all the time
and pass data from one UART to another UART according to the data come from UART.
Do you know of some example that can show me part of this program.
when you say ‘AT+LUA is only available when the Lua sample is loaded’ - Lua sample is the shell example because i try to use it
and i get error there.
can i use the shell during another Lua program is running and using UART port.
if yes how can i change the debug trace to the shell i will open from another gprs connection?
It’s an “ell”, as in “Load”, not a “one”! l(‘at.lua’), not 1(‘at.lua’). Notice also that when there’s a single arg which is a litteral string, parentheses are optional, so you can just type l’at.lua’; moreover, the function will add the ‘.lua’ prefix if you provide a filename without an extension, so you can just type: l ‘at’. Finally, it remembers the last file names used, even across reboots, so if you reload at.lua a second time you can just type l(). Since that’s a command you’re going to type a lot, you’d better shorten it as much as possible!
It works pretty much like WIP: x:get() returns a channel on which you can read your content, and put it wherever you want. For instance (untested code):
From now on, you can do pretty much what you want with the file content, for instance:
$ save 'file_content' -- commit the global variable to flash
$ compiled_code, error_msg = loadstring(file_content) -- compile it, assuming it's a source file
$ if compile_code then compile_code() -- run the resulting function if compilation succeeded
+ else printf("Couldn't compile your stuff: %s", error_msg) end
$ save 'compiled_code' -- you can also save the compiled function if you prefer
Of course, you might want the file in other ways than just a single string, especially if the file is huge or if you have to fir within 256KB. Again, refer to the doc for more advanced tricks.
BTW, hooking a print function to the channel to better follow what it does is a pretty neat trick However, you normally don’t have to use the content of the “internal” module: it only provides crude interfaces to C features, but whatever you have to use will be offered in other modules, generally with a nicer API. In this case, wip.ftp_client() will wait for authentication to complete, and make most parameters optional.