mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-16 04:43:25 +00:00
espat,wifinina,rtl8720dn: change ssid/pass from const to var
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
//
|
//
|
||||||
// More information on the Espressif AT command set at:
|
// More information on the Espressif AT command set at:
|
||||||
// https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
|
// https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -19,9 +18,11 @@ import (
|
|||||||
// change actAsAP to true to act as an access point instead of connecting to one.
|
// change actAsAP to true to act as an access point instead of connecting to one.
|
||||||
const actAsAP = false
|
const actAsAP = false
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// these are the default pins for the Arduino Nano33 IoT.
|
// these are the default pins for the Arduino Nano33 IoT.
|
||||||
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
//
|
//
|
||||||
// In other words:
|
// In other words:
|
||||||
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266 <--> INTERNET
|
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266 <--> INTERNET
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -17,9 +16,11 @@ import (
|
|||||||
// change actAsAP to true to act as an access point instead of connecting to one.
|
// change actAsAP to true to act as an access point instead of connecting to one.
|
||||||
const actAsAP = false
|
const actAsAP = false
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// these are the default pins for the Arduino Nano33 IoT.
|
// these are the default pins for the Arduino Nano33 IoT.
|
||||||
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
//
|
//
|
||||||
// In other words:
|
// In other words:
|
||||||
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266
|
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -14,9 +13,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/net"
|
"tinygo.org/x/drivers/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the listener aka "hub". Replace with your own info.
|
// IP address of the listener aka "hub". Replace with your own info.
|
||||||
const hubIP = "0.0.0.0"
|
const hubIP = "0.0.0.0"
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
//
|
//
|
||||||
// You must install the Paho MQTT package to build this program:
|
// You must install the Paho MQTT package to build this program:
|
||||||
//
|
//
|
||||||
// go get -u github.com/eclipse/paho.mqtt.golang
|
// go get -u github.com/eclipse/paho.mqtt.golang
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -20,9 +19,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/net/mqtt"
|
"tinygo.org/x/drivers/net/mqtt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the MQTT broker to use. Replace with your own info.
|
// IP address of the MQTT broker to use. Replace with your own info.
|
||||||
const server = "tcp://test.mosquitto.org:1883"
|
const server = "tcp://test.mosquitto.org:1883"
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
//
|
//
|
||||||
// You must also install the Paho MQTT package to build this program:
|
// You must also install the Paho MQTT package to build this program:
|
||||||
//
|
//
|
||||||
// go get -u github.com/eclipse/paho.mqtt.golang
|
// go get -u github.com/eclipse/paho.mqtt.golang
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -21,9 +20,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/net/mqtt"
|
"tinygo.org/x/drivers/net/mqtt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the MQTT broker to use. Replace with your own info.
|
// IP address of the MQTT broker to use. Replace with your own info.
|
||||||
//const server = "tcp://test.mosquitto.org:1883"
|
//const server = "tcp://test.mosquitto.org:1883"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
//
|
//
|
||||||
// In other words:
|
// In other words:
|
||||||
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266
|
// Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -14,9 +13,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/net"
|
"tinygo.org/x/drivers/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = "YOURSSID"
|
// access point info
|
||||||
const pass = "YOURPASS"
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const serverIP = "0.0.0.0"
|
const serverIP = "0.0.0.0"
|
||||||
|
|||||||
@@ -29,16 +29,16 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// debug = true
|
// debug = true
|
||||||
// server = "tinygo.org"
|
// server = "tinygo.org"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
server string = "tcp://test.mosquitto.org:1883"
|
server string = "tcp://test.mosquitto.org:1883"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var buf [0x400]byte
|
var buf [0x400]byte
|
||||||
@@ -65,7 +65,7 @@ func run() error {
|
|||||||
adaptor.Debug(debug)
|
adaptor.Debug(debug)
|
||||||
adaptor.Configure()
|
adaptor.Configure()
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,16 +30,16 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// debug = true
|
// debug = true
|
||||||
// server = "tinygo.org"
|
// server = "tinygo.org"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
server string = "tcp://test.mosquitto.org:1883"
|
server string = "tcp://test.mosquitto.org:1883"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var buf [0x400]byte
|
var buf [0x400]byte
|
||||||
@@ -74,7 +74,7 @@ func run() error {
|
|||||||
adaptor.Debug(debug)
|
adaptor.Debug(debug)
|
||||||
adaptor.Configure()
|
adaptor.Configure()
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// ntpHost = "129.6.15.29"
|
// ntpHost = "129.6.15.29"
|
||||||
// debug = true
|
// debug = true
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
ntpHost = "129.6.15.29"
|
ntpHost = "129.6.15.29"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
const NTP_PACKET_SIZE = 48
|
const NTP_PACKET_SIZE = 48
|
||||||
@@ -48,7 +48,7 @@ func run() error {
|
|||||||
adaptor.Debug(debug)
|
adaptor.Debug(debug)
|
||||||
adaptor.Configure()
|
adaptor.Configure()
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// serverIP = "192.168.1.119"
|
// serverIP = "192.168.1.119"
|
||||||
// debug = true
|
// debug = true
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
serverIP = ""
|
serverIP = ""
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
@@ -47,7 +47,7 @@ func run() error {
|
|||||||
adaptor.Debug(debug)
|
adaptor.Debug(debug)
|
||||||
adaptor.Configure()
|
adaptor.Configure()
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// debug = true
|
// debug = true
|
||||||
// url = "https://www.example.com"
|
// url = "https://www.example.com"
|
||||||
// test_root_ca = "..."
|
// test_root_ca = "..."
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
url string = "https://www.example.com"
|
url string = "https://www.example.com"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set the test_root_ca created by the following command
|
// Set the test_root_ca created by the following command
|
||||||
@@ -76,7 +76,7 @@ func run() error {
|
|||||||
adaptor.SetRootCA(&test_root_ca)
|
adaptor.SetRootCA(&test_root_ca)
|
||||||
http.SetBuf(buf[:])
|
http.SetBuf(buf[:])
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// hubIP = "192.168.1.118"
|
// hubIP = "192.168.1.118"
|
||||||
// debug = true
|
// debug = true
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
hubIP = ""
|
hubIP = ""
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var buf [0x400]byte
|
var buf [0x400]byte
|
||||||
@@ -45,7 +45,7 @@ func run() error {
|
|||||||
|
|
||||||
http.SetBuf(buf[:])
|
http.SetBuf(buf[:])
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ import (
|
|||||||
// If debug is enabled, a serial connection is required.
|
// If debug is enabled, a serial connection is required.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// debug = false // true
|
// debug = false // true
|
||||||
// server = "tinygo.org"
|
// server = "tinygo.org"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
url = "http://tinygo.org/"
|
url = "http://tinygo.org/"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -88,7 +88,7 @@ func run() error {
|
|||||||
http.SetBuf(buf[:])
|
http.SetBuf(buf[:])
|
||||||
|
|
||||||
fmt.Fprintf(terminal, "ConnectToAP()\r\n")
|
fmt.Fprintf(terminal, "ConnectToAP()\r\n")
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// url = "http://tinygo.org/"
|
// url = "http://tinygo.org/"
|
||||||
// debug = true
|
// debug = true
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
url = "http://tinygo.org/"
|
url = "http://tinygo.org/"
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var buf [0x400]byte
|
var buf [0x400]byte
|
||||||
@@ -45,7 +45,7 @@ func run() error {
|
|||||||
http.UseDriver(adaptor)
|
http.UseDriver(adaptor)
|
||||||
http.SetBuf(buf[:])
|
http.SetBuf(buf[:])
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ import (
|
|||||||
// You can override the setting with the init() in another source code.
|
// You can override the setting with the init() in another source code.
|
||||||
// func init() {
|
// func init() {
|
||||||
// ssid = "your-ssid"
|
// ssid = "your-ssid"
|
||||||
// password = "your-password"
|
// pass = "your-password"
|
||||||
// debug = true
|
// debug = true
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ssid string
|
ssid string
|
||||||
password string
|
pass string
|
||||||
debug = false
|
debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
var led = machine.LED
|
var led = machine.LED
|
||||||
@@ -44,7 +44,7 @@ func run() error {
|
|||||||
|
|
||||||
http.UseDriver(adaptor)
|
http.UseDriver(adaptor)
|
||||||
|
|
||||||
err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second)
|
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
// You can open a server to accept connections from this program using:
|
// You can open a server to accept connections from this program using:
|
||||||
//
|
//
|
||||||
// nc -w 5 -lk 8080
|
// nc -w 5 -lk 8080
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -15,9 +14,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/net"
|
"tinygo.org/x/drivers/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const serverIP = ""
|
const serverIP = ""
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// these are the default pins for the Arduino Nano33 IoT.
|
// these are the default pins for the Arduino Nano33 IoT.
|
||||||
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
// change these to connect to a different UART or pins for the ESP8266/ESP32
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
//
|
//
|
||||||
// examples/wifinina/webclient
|
// examples/wifinina/webclient
|
||||||
// examples/wifinina/tlsclient
|
// examples/wifinina/tlsclient
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -24,9 +23,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
// Can specify a URL starting with http or https
|
// Can specify a URL starting with http or https
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
//
|
//
|
||||||
// You must install the Paho MQTT package to build this program:
|
// You must install the Paho MQTT package to build this program:
|
||||||
//
|
//
|
||||||
// go get -u github.com/eclipse/paho.mqtt.golang
|
// go get -u github.com/eclipse/paho.mqtt.golang
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -21,9 +20,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the MQTT broker to use. Replace with your own info.
|
// IP address of the MQTT broker to use. Replace with your own info.
|
||||||
const server = "tcp://test.mosquitto.org:1883"
|
const server = "tcp://test.mosquitto.org:1883"
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
//
|
//
|
||||||
// You must also install the Paho MQTT package to build this program:
|
// You must also install the Paho MQTT package to build this program:
|
||||||
//
|
//
|
||||||
// go get -u github.com/eclipse/paho.mqtt.golang
|
// go get -u github.com/eclipse/paho.mqtt.golang
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -21,9 +20,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the MQTT broker to use. Replace with your own info.
|
// IP address of the MQTT broker to use. Replace with your own info.
|
||||||
const server = "tcp://test.mosquitto.org:1883"
|
const server = "tcp://test.mosquitto.org:1883"
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const ntpHost = "129.6.15.29"
|
const ntpHost = "129.6.15.29"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
// You can open a server to accept connections from this program using:
|
// You can open a server to accept connections from this program using:
|
||||||
//
|
//
|
||||||
// nc -w 5 -lk 8080
|
// nc -w 5 -lk 8080
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -17,9 +16,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const serverIP = ""
|
const serverIP = ""
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
// You shall see "strict-transport-security" header in the response,
|
// You shall see "strict-transport-security" header in the response,
|
||||||
// this confirms communication is indeed over HTTPS
|
// this confirms communication is indeed over HTTPS
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -18,9 +17,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const server = "tinygo.org"
|
const server = "tinygo.org"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
//
|
//
|
||||||
// In other words:
|
// In other words:
|
||||||
// Your computer <--> UART0 <--> MCU <--> SPI <--> ESP32
|
// Your computer <--> UART0 <--> MCU <--> SPI <--> ESP32
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -15,9 +14,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const hubIP = ""
|
const hubIP = ""
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
// Arduino example:
|
// Arduino example:
|
||||||
//
|
//
|
||||||
// https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/WiFiWebClientRepeating/
|
// https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/WiFiWebClientRepeating/
|
||||||
//
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -15,9 +14,11 @@ import (
|
|||||||
"tinygo.org/x/drivers/wifinina"
|
"tinygo.org/x/drivers/wifinina"
|
||||||
)
|
)
|
||||||
|
|
||||||
// access point info
|
var (
|
||||||
const ssid = ""
|
// access point info
|
||||||
const pass = ""
|
ssid string
|
||||||
|
pass string
|
||||||
|
)
|
||||||
|
|
||||||
// IP address of the server aka "hub". Replace with your own info.
|
// IP address of the server aka "hub". Replace with your own info.
|
||||||
const server = "tinygo.org"
|
const server = "tinygo.org"
|
||||||
|
|||||||
Reference in New Issue
Block a user