Skip to content

Commit 0d6c45f

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into cp_logging
2 parents b01005f + 5218936 commit 0d6c45f

293 files changed

Lines changed: 939328 additions & 345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#define TC_PIN A0 // set to ADC pin used
2+
#define AREF 3.3 // set to AREF, typically board voltage like 3.3 or 5.0
3+
#define ADC_RESOLUTION 10 // set to ADC bit resolution, 10 is default
4+
5+
float reading, voltage, temperature;
6+
7+
float get_voltage(int raw_adc) {
8+
return raw_adc * (AREF / (pow(2, ADC_RESOLUTION)-1));
9+
}
10+
11+
float get_temperature(float voltage) {
12+
return (voltage - 1.25) / 0.005;
13+
}
14+
15+
void setup() {
16+
Serial.begin(9600);
17+
}
18+
19+
void loop() {
20+
reading = analogRead(TC_PIN);
21+
voltage = get_voltage(reading);
22+
temperature = get_temperature(voltage);
23+
Serial.print("Temperature = ");
24+
Serial.print(temperature);
25+
Serial.println(" C");
26+
delay(500);
27+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import time
2+
import analogio
3+
import board
4+
5+
ad8495 = analogio.AnalogIn(board.A1)
6+
7+
8+
def get_voltage(pin):
9+
return (pin.value * 3.3) / 65536
10+
11+
12+
while True:
13+
temperature = (get_voltage(ad8495) - 1.25) / 0.005
14+
print(temperature)
15+
print(get_voltage(ad8495))
16+
time.sleep(0.5)
Binary file not shown.
Binary file not shown.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
#include <Adafruit_NeoPixel.h>
23+
24+
unsigned long baud = 115200;
25+
26+
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, 2, NEO_GRB + NEO_KHZ800);
27+
28+
29+
void setup() {
30+
Serial.begin(baud);
31+
pixel.begin();
32+
pixel.setPixelColor(0, 10, 10, 10); pixel.show();
33+
34+
while (!Serial);
35+
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
36+
37+
delay(100);
38+
SerialNina.begin(baud);
39+
40+
pinMode(13, OUTPUT);
41+
pinMode(NINA_GPIO0, OUTPUT);
42+
pinMode(NINA_RESETN, OUTPUT);
43+
44+
// manually put the ESP32 in upload mode
45+
digitalWrite(NINA_GPIO0, LOW);
46+
47+
digitalWrite(NINA_RESETN, LOW);
48+
delay(100);
49+
digitalWrite(NINA_RESETN, HIGH);
50+
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
51+
delay(100);
52+
}
53+
54+
void loop() {
55+
while (Serial.available()) {
56+
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
57+
SerialESP32.write(Serial.read());
58+
}
59+
60+
while (SerialNina.available()) {
61+
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
62+
Serial.write(SerialNina.read());
63+
}
64+
}
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: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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+
// if the wifi definition isnt in the board variant
28+
#if !defined(SPIWIFI_SS)
29+
// Don't change the names of these #define's! they match the variant ones
30+
#define SPIWIFI_SS 10
31+
#define SPIWIFI_ACK 7
32+
#define ESP32_RESETN 5
33+
#define ESP32_GPIO0 -1
34+
#define SPIWIFI SPI
35+
#endif
36+
37+
38+
#include "arduino_secrets.h"
39+
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
40+
char ssid[] = SECRET_SSID; // your network SSID (name)
41+
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
42+
int keyIndex = 0; // your network key Index number (needed only for WEP)
43+
44+
int status = WL_IDLE_STATUS;
45+
// if you don't want to use DNS (and reduce your sketch size)
46+
// use the numeric IP instead of the name for the server:
47+
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
48+
49+
char server[] = "wifitest.adafruit.com"; // name address for adafruit test
50+
char path[] = "/testwifi/index.html";
51+
52+
// Initialize the Ethernet client library
53+
// with the IP address and port of the server
54+
// that you want to connect to (port 80 is default for HTTP):
55+
WiFiClient client;
56+
57+
void setup() {
58+
//Initialize serial and wait for port to open:
59+
Serial.begin(9600);
60+
while (!Serial) {
61+
; // wait for serial port to connect. Needed for native USB port only
62+
}
63+
64+
// check for the WiFi module:
65+
WiFi.setPins(SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
66+
while (WiFi.status() == WL_NO_MODULE) {
67+
Serial.println("Communication with WiFi module failed!");
68+
// don't continue
69+
delay(1000);
70+
}
71+
72+
String fv = WiFi.firmwareVersion();
73+
if (fv < "1.0.0") {
74+
Serial.println("Please upgrade the firmware");
75+
}
76+
Serial.print("Found firmware "); Serial.println(fv);
77+
78+
// attempt to connect to Wifi network:
79+
Serial.print("Attempting to connect to SSID: ");
80+
Serial.println(ssid);
81+
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
82+
do {
83+
status = WiFi.begin(ssid, pass);
84+
delay(100); // wait until connection is ready!
85+
} while (status != WL_CONNECTED);
86+
87+
Serial.println("Connected to wifi");
88+
printWifiStatus();
89+
90+
Serial.println("\nStarting connection to server...");
91+
// if you get a connection, report back via serial:
92+
if (client.connect(server, 80)) {
93+
Serial.println("connected to server");
94+
// Make a HTTP request:
95+
client.print("GET "); client.print(path); client.println(" HTTP/1.1");
96+
client.print("Host: "); client.println(server);
97+
client.println("Connection: close");
98+
client.println();
99+
}
100+
}
101+
102+
void loop() {
103+
// if there are incoming bytes available
104+
// from the server, read them and print them:
105+
while (client.available()) {
106+
char c = client.read();
107+
Serial.write(c);
108+
}
109+
110+
// if the server's disconnected, stop the client:
111+
if (!client.connected()) {
112+
Serial.println();
113+
Serial.println("disconnecting from server.");
114+
client.stop();
115+
116+
// do nothing forevermore:
117+
while (true);
118+
}
119+
}
120+
121+
122+
void printWifiStatus() {
123+
// print the SSID of the network you're attached to:
124+
Serial.print("SSID: ");
125+
Serial.println(WiFi.SSID());
126+
127+
// print your board's IP address:
128+
IPAddress ip = WiFi.localIP();
129+
Serial.print("IP Address: ");
130+
Serial.println(ip);
131+
132+
// print the received signal strength:
133+
long rssi = WiFi.RSSI();
134+
Serial.print("signal strength (RSSI):");
135+
Serial.print(rssi);
136+
Serial.println(" dBm");
137+
}
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)