Skip to content

Commit 96ca4e4

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into pyportal_alarm_clock
2 parents 12ed609 + 5ec4b45 commit 96ca4e4

46 files changed

Lines changed: 215028 additions & 29 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*~
22
Hue_Controller/secrets.h
33
.idea
4+
5+
CircuitPython_Logger/secrets\.py
Binary file not shown.
Binary file not shown.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
SerialNINAPassthrough - Use esptool to flash the ESP32 module
3+
For use with PyPortal, Metro M4 WiFi...
4+
5+
Copyright (c) 2018 Arduino SA. All rights reserved.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
22+
unsigned long baud = 115200;
23+
24+
void setup() {
25+
Serial.begin(baud);
26+
27+
SerialNina.begin(baud);
28+
29+
pinMode(13, OUTPUT);
30+
pinMode(ESP32_GPIO0, OUTPUT);
31+
pinMode(ESP32_RESETN, OUTPUT);
32+
33+
// manually put the ESP32 in upload mode
34+
digitalWrite(ESP32_GPIO0, LOW);
35+
36+
digitalWrite(ESP32_RESETN, LOW);
37+
delay(100);
38+
digitalWrite(ESP32_RESETN, HIGH);
39+
40+
}
41+
42+
void loop() {
43+
if (Serial.available()) {
44+
digitalWrite(13, HIGH);
45+
SerialESP32.write(Serial.read());
46+
digitalWrite(13, LOW);
47+
}
48+
49+
if (SerialESP32.available()) {
50+
Serial.write(SerialESP32.read());
51+
}
52+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
This example creates a client object that connects and transfers
3+
data using always SSL.
4+
5+
It is compatible with the methods normally related to plain
6+
connections, like client.connect(host, port).
7+
8+
Written by Arturo Guadalupi
9+
last revision November 2015
10+
11+
*/
12+
13+
#include <SPI.h>
14+
#include <WiFiNINA.h>
15+
16+
#include "arduino_secrets.h"
17+
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
18+
char ssid[] = SECRET_SSID; // your network SSID (name)
19+
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
20+
int keyIndex = 0; // your network key Index number (needed only for WEP)
21+
22+
int status = WL_IDLE_STATUS;
23+
// if you don't want to use DNS (and reduce your sketch size)
24+
// use the numeric IP instead of the name for the server:
25+
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
26+
27+
//#define SERVER "www.google.com" // name address for Google (using DNS)
28+
//#define PATH "/search?q=arduino"
29+
30+
#define SERVER "cdn.syndication.twimg.com"
31+
#define PATH "/widgets/followbutton/info.json?screen_names=adafruit"
32+
33+
//#define SERVER "img.shields.io"
34+
//#define PATH "/discord/327254708534116352.svg"
35+
36+
//#define SERVER "cdn.thingiverse.com"
37+
//#define PATH "/renders/77/0c/f0/f6/2e/dbc6c3056540bdf03757ecc90fbe4b5f_preview_featured.jpg"
38+
39+
40+
// Initialize the SSL client library
41+
// with the IP address and port of the server
42+
// that you want to connect to (port 443 is default for HTTPS):
43+
WiFiSSLClient client;
44+
45+
void setup() {
46+
//Initialize serial and wait for port to open:
47+
Serial.begin(9600);
48+
while (!Serial) {
49+
; // wait for serial port to connect. Needed for native USB port only
50+
}
51+
52+
// check for the WiFi module:
53+
while (WiFi.status() == WL_NO_MODULE) {
54+
Serial.println("Communication with WiFi module failed!");
55+
delay(1000);
56+
}
57+
58+
String fv = WiFi.firmwareVersion();
59+
if (fv < "1.0.0") {
60+
Serial.println("Please upgrade the firmware");
61+
}
62+
63+
// attempt to connect to Wifi network:
64+
Serial.print("Attempting to connect to SSID: ");
65+
Serial.println(ssid);
66+
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
67+
do {
68+
status = WiFi.begin(ssid, pass);
69+
delay(100); // wait until connected
70+
} while (status != WL_CONNECTED);
71+
Serial.println("Connected to wifi");
72+
printWifiStatus();
73+
74+
Serial.println("\nStarting connection to server...");
75+
// if you get a connection, report back via serial:
76+
if (client.connect(SERVER, 443)) {
77+
Serial.println("connected to server");
78+
// Make a HTTP request:
79+
client.println("GET " PATH " HTTP/1.1");
80+
client.println("Host: " SERVER);
81+
client.println("Connection: close");
82+
client.println();
83+
}
84+
}
85+
86+
uint32_t bytes = 0;
87+
88+
void loop() {
89+
// if there are incoming bytes available
90+
// from the server, read them and print them:
91+
while (client.available()) {
92+
char c = client.read();
93+
Serial.write(c);
94+
bytes++;
95+
}
96+
97+
// if the server's disconnected, stop the client:
98+
if (!client.connected()) {
99+
Serial.println();
100+
Serial.println("disconnecting from server.");
101+
client.stop();
102+
Serial.print("Read "); Serial.print(bytes); Serial.println(" bytes");
103+
104+
// do nothing forevermore:
105+
while (true);
106+
}
107+
}
108+
109+
110+
void printWifiStatus() {
111+
// print the SSID of the network you're attached to:
112+
Serial.print("SSID: ");
113+
Serial.println(WiFi.SSID());
114+
115+
// print your board's IP address:
116+
IPAddress ip = WiFi.localIP();
117+
Serial.print("IP Address: ");
118+
Serial.println(ip);
119+
120+
// print the received signal strength:
121+
long rssi = WiFi.RSSI();
122+
Serial.print("signal strength (RSSI):");
123+
Serial.print(rssi);
124+
Serial.println(" dBm");
125+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define SECRET_SSID "ssid name"
2+
#define SECRET_PASS "ssid password"
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
2+
/*
3+
Web client
4+
5+
This sketch connects to a website (wifitest.adafruit.com/testwifi/index.html)
6+
using the WiFi module.
7+
8+
This example is written for a network using WPA encryption. For
9+
WEP or WPA, change the Wifi.begin() call accordingly.
10+
11+
This example is written for a network using WPA encryption. For
12+
WEP or WPA, change the Wifi.begin() call accordingly.
13+
14+
Circuit:
15+
* Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2)
16+
17+
created 13 July 2010
18+
by dlf (Metodo2 srl)
19+
modified 31 May 2012
20+
by Tom Igoe
21+
*/
22+
23+
24+
#include <SPI.h>
25+
#include <WiFiNINA.h>
26+
27+
#include "arduino_secrets.h"
28+
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
29+
char ssid[] = SECRET_SSID; // your network SSID (name)
30+
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
31+
int keyIndex = 0; // your network key Index number (needed only for WEP)
32+
33+
int status = WL_IDLE_STATUS;
34+
// if you don't want to use DNS (and reduce your sketch size)
35+
// use the numeric IP instead of the name for the server:
36+
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
37+
38+
char server[] = "wifitest.adafruit.com"; // name address for adafruit test
39+
char path[] = "/testwifi/index.html";
40+
41+
// Initialize the Ethernet client library
42+
// with the IP address and port of the server
43+
// that you want to connect to (port 80 is default for HTTP):
44+
WiFiClient client;
45+
46+
void setup() {
47+
//Initialize serial and wait for port to open:
48+
Serial.begin(9600);
49+
while (!Serial) {
50+
; // wait for serial port to connect. Needed for native USB port only
51+
}
52+
53+
// check for the WiFi module:
54+
while (WiFi.status() == WL_NO_MODULE) {
55+
Serial.println("Communication with WiFi module failed!");
56+
// don't continue
57+
delay(1000);
58+
59+
}
60+
61+
String fv = WiFi.firmwareVersion();
62+
if (fv < "1.0.0") {
63+
Serial.println("Please upgrade the firmware");
64+
}
65+
66+
// attempt to connect to Wifi network:
67+
Serial.print("Attempting to connect to SSID: ");
68+
Serial.println(ssid);
69+
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
70+
do {
71+
status = WiFi.begin(ssid, pass);
72+
delay(100); // wait until connection is ready!
73+
} while (status != WL_CONNECTED);
74+
75+
Serial.println("Connected to wifi");
76+
printWifiStatus();
77+
78+
Serial.println("\nStarting connection to server...");
79+
// if you get a connection, report back via serial:
80+
if (client.connect(server, 80)) {
81+
Serial.println("connected to server");
82+
// Make a HTTP request:
83+
client.print("GET "); client.print(path); client.println(" HTTP/1.1");
84+
client.print("Host: "); client.println(server);
85+
client.println("Connection: close");
86+
client.println();
87+
}
88+
}
89+
90+
void loop() {
91+
// if there are incoming bytes available
92+
// from the server, read them and print them:
93+
while (client.available()) {
94+
char c = client.read();
95+
Serial.write(c);
96+
}
97+
98+
// if the server's disconnected, stop the client:
99+
if (!client.connected()) {
100+
Serial.println();
101+
Serial.println("disconnecting from server.");
102+
client.stop();
103+
104+
// do nothing forevermore:
105+
while (true);
106+
}
107+
}
108+
109+
110+
void printWifiStatus() {
111+
// print the SSID of the network you're attached to:
112+
Serial.print("SSID: ");
113+
Serial.println(WiFi.SSID());
114+
115+
// print your board's IP address:
116+
IPAddress ip = WiFi.localIP();
117+
Serial.print("IP Address: ");
118+
Serial.println(ip);
119+
120+
// print the received signal strength:
121+
long rssi = WiFi.RSSI();
122+
Serial.print("signal strength (RSSI):");
123+
Serial.print(rssi);
124+
Serial.println(" dBm");
125+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define SECRET_SSID "your wifi ssid"
2+
#define SECRET_PASS "your wifi password"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define SECRET_SSID "ssid"
2+
#define SECRET_PASS "password"

0 commit comments

Comments
 (0)