diff --git a/examples/espat/espconsole/main.go b/examples/espat/espconsole/main.go index d4b7f57..ad55006 100644 --- a/examples/espat/espconsole/main.go +++ b/examples/espat/espconsole/main.go @@ -6,7 +6,6 @@ // // More information on the Espressif AT command set at: // https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf -// package main import ( @@ -19,9 +18,11 @@ import ( // change actAsAP to true to act as an access point instead of connecting to one. const actAsAP = false -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // these are the default pins for the Arduino Nano33 IoT. // change these to connect to a different UART or pins for the ESP8266/ESP32 diff --git a/examples/espat/esphub/main.go b/examples/espat/esphub/main.go index ba9fff2..e253955 100644 --- a/examples/espat/esphub/main.go +++ b/examples/espat/esphub/main.go @@ -3,7 +3,6 @@ // // In other words: // Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266 <--> INTERNET -// package main import ( @@ -17,9 +16,11 @@ import ( // change actAsAP to true to act as an access point instead of connecting to one. const actAsAP = false -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // these are the default pins for the Arduino Nano33 IoT. // change these to connect to a different UART or pins for the ESP8266/ESP32 diff --git a/examples/espat/espstation/main.go b/examples/espat/espstation/main.go index fb08f92..5ae2e3d 100644 --- a/examples/espat/espstation/main.go +++ b/examples/espat/espstation/main.go @@ -3,7 +3,6 @@ // // In other words: // Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266 -// package main import ( @@ -14,9 +13,11 @@ import ( "tinygo.org/x/drivers/net" ) -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // IP address of the listener aka "hub". Replace with your own info. const hubIP = "0.0.0.0" diff --git a/examples/espat/mqttclient/main.go b/examples/espat/mqttclient/main.go index 3c6bd23..aaa8855 100644 --- a/examples/espat/mqttclient/main.go +++ b/examples/espat/mqttclient/main.go @@ -7,8 +7,7 @@ // // 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 import ( @@ -20,9 +19,11 @@ import ( "tinygo.org/x/drivers/net/mqtt" ) -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // IP address of the MQTT broker to use. Replace with your own info. const server = "tcp://test.mosquitto.org:1883" diff --git a/examples/espat/mqttsub/main.go b/examples/espat/mqttsub/main.go index a4547cb..6575385 100644 --- a/examples/espat/mqttsub/main.go +++ b/examples/espat/mqttsub/main.go @@ -7,8 +7,7 @@ // // 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 import ( @@ -21,9 +20,11 @@ import ( "tinygo.org/x/drivers/net/mqtt" ) -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // IP address of the MQTT broker to use. Replace with your own info. //const server = "tcp://test.mosquitto.org:1883" diff --git a/examples/espat/tcpclient/main.go b/examples/espat/tcpclient/main.go index ee5c024..db1bcb8 100644 --- a/examples/espat/tcpclient/main.go +++ b/examples/espat/tcpclient/main.go @@ -3,7 +3,6 @@ // // In other words: // Your computer <--> UART0 <--> MCU <--> UART1 <--> ESP8266 -// package main import ( @@ -14,9 +13,11 @@ import ( "tinygo.org/x/drivers/net" ) -// access point info -const ssid = "YOURSSID" -const pass = "YOURPASS" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const serverIP = "0.0.0.0" diff --git a/examples/rtl8720dn/mqttclient/main.go b/examples/rtl8720dn/mqttclient/main.go index c49e521..f4e8d84 100644 --- a/examples/rtl8720dn/mqttclient/main.go +++ b/examples/rtl8720dn/mqttclient/main.go @@ -29,16 +29,16 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // debug = true // server = "tinygo.org" // } var ( - ssid string - password string - server string = "tcp://test.mosquitto.org:1883" - debug = false + ssid string + pass string + server string = "tcp://test.mosquitto.org:1883" + debug = false ) var buf [0x400]byte @@ -65,7 +65,7 @@ func run() error { adaptor.Debug(debug) adaptor.Configure() - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/mqttsub/main.go b/examples/rtl8720dn/mqttsub/main.go index 46fdcb1..6c53313 100644 --- a/examples/rtl8720dn/mqttsub/main.go +++ b/examples/rtl8720dn/mqttsub/main.go @@ -30,16 +30,16 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // debug = true // server = "tinygo.org" // } var ( - ssid string - password string - server string = "tcp://test.mosquitto.org:1883" - debug = false + ssid string + pass string + server string = "tcp://test.mosquitto.org:1883" + debug = false ) var buf [0x400]byte @@ -74,7 +74,7 @@ func run() error { adaptor.Debug(debug) adaptor.Configure() - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/ntpclient/main.go b/examples/rtl8720dn/ntpclient/main.go index 1e5f186..2d52d73 100644 --- a/examples/rtl8720dn/ntpclient/main.go +++ b/examples/rtl8720dn/ntpclient/main.go @@ -19,16 +19,16 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // ntpHost = "129.6.15.29" // debug = true // } var ( - ssid string - password string - ntpHost = "129.6.15.29" - debug = false + ssid string + pass string + ntpHost = "129.6.15.29" + debug = false ) const NTP_PACKET_SIZE = 48 @@ -48,7 +48,7 @@ func run() error { adaptor.Debug(debug) adaptor.Configure() - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/tcpclient/main.go b/examples/rtl8720dn/tcpclient/main.go index ce31732..650f415 100644 --- a/examples/rtl8720dn/tcpclient/main.go +++ b/examples/rtl8720dn/tcpclient/main.go @@ -20,14 +20,14 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // serverIP = "192.168.1.119" // debug = true // } var ( ssid string - password string + pass string serverIP = "" debug = false ) @@ -47,7 +47,7 @@ func run() error { adaptor.Debug(debug) adaptor.Configure() - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/tlsclient/main.go b/examples/rtl8720dn/tlsclient/main.go index fafdc23..e86dd93 100644 --- a/examples/rtl8720dn/tlsclient/main.go +++ b/examples/rtl8720dn/tlsclient/main.go @@ -16,17 +16,17 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // debug = true // url = "https://www.example.com" // test_root_ca = "..." // } var ( - ssid string - password string - url string = "https://www.example.com" - debug = false + ssid string + pass string + url string = "https://www.example.com" + debug = false ) // Set the test_root_ca created by the following command @@ -76,7 +76,7 @@ func run() error { adaptor.SetRootCA(&test_root_ca) http.SetBuf(buf[:]) - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/udpstation/main.go b/examples/rtl8720dn/udpstation/main.go index f4367ee..fead6c5 100644 --- a/examples/rtl8720dn/udpstation/main.go +++ b/examples/rtl8720dn/udpstation/main.go @@ -16,16 +16,16 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // hubIP = "192.168.1.118" // debug = true // } var ( - ssid string - password string - hubIP = "" - debug = false + ssid string + pass string + hubIP = "" + debug = false ) var buf [0x400]byte @@ -45,7 +45,7 @@ func run() error { http.SetBuf(buf[:]) - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/webclient-tinyterm/main.go b/examples/rtl8720dn/webclient-tinyterm/main.go index f705968..060aaf7 100644 --- a/examples/rtl8720dn/webclient-tinyterm/main.go +++ b/examples/rtl8720dn/webclient-tinyterm/main.go @@ -21,16 +21,16 @@ import ( // If debug is enabled, a serial connection is required. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // debug = false // true // server = "tinygo.org" // } var ( - ssid string - password string - url = "http://tinygo.org/" - debug = false + ssid string + pass string + url = "http://tinygo.org/" + debug = false ) var ( @@ -88,7 +88,7 @@ func run() error { http.SetBuf(buf[:]) 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 { return err } diff --git a/examples/rtl8720dn/webclient/main.go b/examples/rtl8720dn/webclient/main.go index 7d877dd..5c7dabe 100644 --- a/examples/rtl8720dn/webclient/main.go +++ b/examples/rtl8720dn/webclient/main.go @@ -15,16 +15,16 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // url = "http://tinygo.org/" // debug = true // } var ( - ssid string - password string - url = "http://tinygo.org/" - debug = false + ssid string + pass string + url = "http://tinygo.org/" + debug = false ) var buf [0x400]byte @@ -45,7 +45,7 @@ func run() error { http.UseDriver(adaptor) http.SetBuf(buf[:]) - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/rtl8720dn/webserver/main.go b/examples/rtl8720dn/webserver/main.go index 4d9a145..6ae17c7 100644 --- a/examples/rtl8720dn/webserver/main.go +++ b/examples/rtl8720dn/webserver/main.go @@ -13,14 +13,14 @@ import ( // You can override the setting with the init() in another source code. // func init() { // ssid = "your-ssid" -// password = "your-password" +// pass = "your-password" // debug = true // } var ( - ssid string - password string - debug = false + ssid string + pass string + debug = false ) var led = machine.LED @@ -44,7 +44,7 @@ func run() error { http.UseDriver(adaptor) - err := adaptor.ConnectToAccessPoint(ssid, password, 10*time.Second) + err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second) if err != nil { return err } diff --git a/examples/wifi/tcpclient/main.go b/examples/wifi/tcpclient/main.go index 6de4609..74eb191 100644 --- a/examples/wifi/tcpclient/main.go +++ b/examples/wifi/tcpclient/main.go @@ -4,7 +4,6 @@ // You can open a server to accept connections from this program using: // // nc -w 5 -lk 8080 -// package main import ( @@ -15,9 +14,11 @@ import ( "tinygo.org/x/drivers/net" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const serverIP = "" diff --git a/examples/wifinina/connect/main.go b/examples/wifinina/connect/main.go index 4a82e02..e758ce4 100644 --- a/examples/wifinina/connect/main.go +++ b/examples/wifinina/connect/main.go @@ -9,9 +9,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // these are the default pins for the Arduino Nano33 IoT. // change these to connect to a different UART or pins for the ESP8266/ESP32 diff --git a/examples/wifinina/http-get/main.go b/examples/wifinina/http-get/main.go index 3ae8d1b..cc44142 100644 --- a/examples/wifinina/http-get/main.go +++ b/examples/wifinina/http-get/main.go @@ -9,7 +9,6 @@ // // examples/wifinina/webclient // examples/wifinina/tlsclient -// package main import ( @@ -24,9 +23,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. // Can specify a URL starting with http or https diff --git a/examples/wifinina/mqttclient/main.go b/examples/wifinina/mqttclient/main.go index 314c996..c03ed92 100644 --- a/examples/wifinina/mqttclient/main.go +++ b/examples/wifinina/mqttclient/main.go @@ -7,8 +7,7 @@ // // 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 import ( @@ -21,9 +20,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the MQTT broker to use. Replace with your own info. const server = "tcp://test.mosquitto.org:1883" diff --git a/examples/wifinina/mqttsub/main.go b/examples/wifinina/mqttsub/main.go index 389c9f6..b19ed1e 100644 --- a/examples/wifinina/mqttsub/main.go +++ b/examples/wifinina/mqttsub/main.go @@ -7,8 +7,7 @@ // // 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 import ( @@ -21,9 +20,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the MQTT broker to use. Replace with your own info. const server = "tcp://test.mosquitto.org:1883" diff --git a/examples/wifinina/ntpclient/main.go b/examples/wifinina/ntpclient/main.go index b215d77..f983519 100644 --- a/examples/wifinina/ntpclient/main.go +++ b/examples/wifinina/ntpclient/main.go @@ -14,9 +14,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const ntpHost = "129.6.15.29" diff --git a/examples/wifinina/tcpclient/main.go b/examples/wifinina/tcpclient/main.go index 3b6276d..a51a910 100644 --- a/examples/wifinina/tcpclient/main.go +++ b/examples/wifinina/tcpclient/main.go @@ -4,7 +4,6 @@ // You can open a server to accept connections from this program using: // // nc -w 5 -lk 8080 -// package main import ( @@ -17,9 +16,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const serverIP = "" diff --git a/examples/wifinina/tlsclient/main.go b/examples/wifinina/tlsclient/main.go index 167ef9b..9e50e89 100644 --- a/examples/wifinina/tlsclient/main.go +++ b/examples/wifinina/tlsclient/main.go @@ -4,7 +4,6 @@ // You shall see "strict-transport-security" header in the response, // this confirms communication is indeed over HTTPS // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security -// package main import ( @@ -18,9 +17,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const server = "tinygo.org" diff --git a/examples/wifinina/udpstation/main.go b/examples/wifinina/udpstation/main.go index 6ba1d28..7c92106 100644 --- a/examples/wifinina/udpstation/main.go +++ b/examples/wifinina/udpstation/main.go @@ -3,7 +3,6 @@ // // In other words: // Your computer <--> UART0 <--> MCU <--> SPI <--> ESP32 -// package main import ( @@ -15,9 +14,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const hubIP = "" diff --git a/examples/wifinina/webclient/main.go b/examples/wifinina/webclient/main.go index a38e293..e8968fe 100644 --- a/examples/wifinina/webclient/main.go +++ b/examples/wifinina/webclient/main.go @@ -3,7 +3,6 @@ // Arduino example: // // https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/WiFiWebClientRepeating/ -// package main import ( @@ -15,9 +14,11 @@ import ( "tinygo.org/x/drivers/wifinina" ) -// access point info -const ssid = "" -const pass = "" +var ( + // access point info + ssid string + pass string +) // IP address of the server aka "hub". Replace with your own info. const server = "tinygo.org"