In fact, the overall GPRS and Wi-Fi is the same principle, is to download the corresponding file with http inside the program, and then run
Look at my program when he will find that the more a document than WIFI
Module (..., package.seeall) - easy access to other files between each other updata0 = nil updata1 = nil updata2 = nil updata3 = nil updata4 = nil updata5 = nil updata6 = nil updata7 = nil updata8 = nil updata9 = nil local USER_DIR_PATH = "/ user_data" - position data stored local filehandle; - All files read using local ABUpdataFile = "a" updataFlage to false = - [[which acquires a program executing]] FILEHANDLE = io.open ( USER_DIR_PATH .. "/ ABUpdataFile.lua", " r") - a program which performs IF FILEHANDLE the then ABUpdataFile = FILEHANDLE: read ( "* All") - reads out the file contents filehandle: close () - Close a file end filehandle=io.open(USER_DIR_PATH.."/version1.lua","r")--读出云端版本 if filehandle then if filehandle:read("*all") ~= "0.0.0" then updataFlage = true end filehandle:close()--关闭文件 end if updataFlage == false then if ABUpdataFile == "A" then print("run:A"); updata0 = require "Aupdata0" updata1 = require "Aupdata1" updata2 = require "Aupdata2" updata3 = require "Aupdata3" updata4 = require "Aupdata4" updata5 = require "Aupdata5" updata6 = require "Aupdata6" updata7 = require "Aupdata7" updata8 = require "Aupdata8" updata9 = require "Aupdata9" else print("run:B"); updata0 = require "Bupdata0" updata1 = require "Bupdata1" updata2 = require "Bupdata2" updata3 = require "Bupdata3" updata4 = require "Bupdata4" updata5 = require "Bupdata5" updata6 = require "Bupdata6" updata7 = require "Bupdata7" updata8 = require "Bupdata8" updata9 = require "Bupdata9" end end
We did not find a hair problem, time does not need to use WIFI
As long as other global variables inside a function, it can be used directly, but can not GPRS
I can access each file in order, so just get so
There is no doubt why I did not put there main.lua
In fact, the beginning, I put mian.lua inside, but found the inside of the main variables can only be used ... can not assign it a value in another file inside
If you do not believe at all that they can test .....
In addition, resetting my program which is used
The reason is that I found the original sys.XXX forget the specific function of ... reset it later! There will be a residual program running on the inside
There is to say, in fact, nothing to do and we upgrade
That day was asked to set the pin as an output, and now want to read pin state how to read, is set to re-enter ??? funny ...
In fact, it can directly read