Hello,
here is my next attempt to write a lib for B4R
The Lib based on the following Libraries (you have to install this bevor you can use this lib):
https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266httpUpdate
i have Testet with the ESP8266 board
regards
Andy
attention: This is a non working example you have to add some code for the versions check and maybe with a timer which will check vor new updates once a day or every hour
You find the .bin file in the folder ..../Objects/bin/ upload this to your webserver.
here is my next attempt to write a lib for B4R
The Lib based on the following Libraries (you have to install this bevor you can use this lib):
https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266httpUpdate
i have Testet with the ESP8266 board
regards
Andy
attention: This is a non working example you have to add some code for the versions check and maybe with a timer which will check vor new updates once a day or every hour
You find the .bin file in the folder ..../Objects/bin/ upload this to your webserver.
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Public ota As ESP8266OTA
Public wifi As ESP8266WiFi
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
wifi.Connect2("<yourssid>","<yourpassword>")
'add here a versioncheck maybe with httpjob and a version.txt file on the server
dim result as string
result=ota.HTTPUpdate2("siam-online.de",80,"/dummy/src.ino.bin",True)
If result <> "success" Then
Log ("Error: ",result)
End If
'add here a versioncheck maybe with httpjob and a version.txt file on the server
dim result as string
result=ota.HTTPUpdate("http://siam-online.de/dummy/src.ino.bin",False)
If result <> "success" Then
Log ("Error: ",result)
else
'you can send here a notification and then restart your esp8266
ota.ESPRestart
End If
End Sub
Attachments
Last edited: