Skip to content

Commit bb064aa

Browse files
2 parents a2a78ed + c4c9ef9 commit bb064aa

File tree

156 files changed

+2728
-225
lines changed

Some content is hidden

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

156 files changed

+2728
-225
lines changed

.github/workflows/githubci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
git clone --quiet https://github.com/adafruit/RadioHead.git /home/runner/Arduino/libraries/RadioHead
3535
git clone --quiet https://github.com/me-no-dev/ESPAsyncTCP /home/runner/Arduino/libraries/ESPAsyncTCP
3636
git clone --quiet https://github.com/adafruit/Talkie /home/runner/Arduino/libraries/Talkie
37+
git clone --quiet https://github.com/Infineon/arduino-optiga-trust-m /home/runner/Arduino/libraries/arduinoOptigaTrustM
3738
3839
- name: test platforms
3940
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ confidence=
5252
# no Warning level messages displayed, use"--disable=all --enable=classes
5353
# --disable=W"
5454
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
55-
disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,consider-using-enumerate,unexpected-keyword-arg,consider-using-f-string
55+
disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,consider-using-enumerate,unexpected-keyword-arg,consider-using-f-string,unspecified-encoding
5656

5757
# Enable the message, report, category or checker with the given id(s). You can
5858
# either give multiple identifier separated by comma (,) or put this option

AIO_Environmental_Monitor/code.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
#
5+
# Adafruit IO Environmental Monitor for Feather or Raspberry Pi -
6+
# an internet-enabled environmental monitor
7+
8+
# Import standard python modules
9+
import time
10+
11+
# import Adafruit Blinka
12+
import board
13+
import busio
14+
15+
# import CircuitPython sensor libraries
16+
import adafruit_sgp30
17+
import adafruit_veml6070
18+
from adafruit_bme280 import basic as adafruit_bme280
19+
20+
# import Adafruit IO REST client
21+
from Adafruit_IO import Client, Feed, RequestError
22+
23+
# loop timeout, in seconds.
24+
LOOP_DELAY = 10
25+
26+
# Set to your Adafruit IO key.
27+
# Remember, your key is a secret,
28+
# so make sure not to publish it when you publish this code!
29+
ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'
30+
31+
# Set to your Adafruit IO username.
32+
# (go to https://accounts.adafruit.com to find your username)
33+
ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'
34+
35+
# Create an instance of the REST client
36+
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
37+
38+
try: # if we already have the feeds, assign them.
39+
tvoc_feed = aio.feeds('tvoc')
40+
eCO2_feed = aio.feeds('eco2')
41+
uv_feed = aio.feeds('uv')
42+
temperature_feed = aio.feeds('temperature')
43+
humidity_feed = aio.feeds('humidity')
44+
pressure_feed = aio.feeds('pressure')
45+
altitude_feed = aio.feeds('altitude')
46+
except RequestError: # if we don't, create and assign them.
47+
tvoc_feed = aio.create_feed(Feed(name='tvoc'))
48+
eCO2_feed = aio.create_feed(Feed(name='eco2'))
49+
uv_feed = aio.create_feed(Feed(name='uv'))
50+
temperature_feed = aio.create_feed(Feed(name='temperature'))
51+
humidity_feed = aio.create_feed(Feed(name='humidity'))
52+
pressure_feed = aio.create_feed(Feed(name='pressure'))
53+
altitude_feed = aio.create_feed(Feed(name='altitude'))
54+
55+
# Create busio I2C
56+
i2c = busio.I2C(board.SCL, board.SDA)
57+
# Create VEML6070 object.
58+
uv = adafruit_veml6070.VEML6070(i2c)
59+
# Create BME280 object.
60+
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
61+
bme280.sea_level_pressure = 1013.25
62+
# Create SGP30 object using I2C.
63+
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
64+
sgp30.iaq_init()
65+
sgp30.set_iaq_baseline(0x8973, 0x8aae)
66+
67+
# Sample VEML6070
68+
def sample_VEML():
69+
for _ in range(10):
70+
uv_raw = uv.uv_raw
71+
return uv_raw
72+
73+
while True:
74+
print('Reading sensors...')
75+
# Read SGP30.
76+
eCO2_data = sgp30.eCO2
77+
tvoc_data = sgp30.TVOC
78+
79+
# Read VEML6070.
80+
uv_data = sample_VEML()
81+
82+
# Read BME280.
83+
temp_data = bme280.temperature
84+
# convert temperature (C->F)
85+
temp_data = int(temp_data) * 1.8 + 32
86+
humid_data = bme280.humidity
87+
pressure_data = bme280.pressure
88+
alt_data = bme280.altitude
89+
90+
print('sending data to adafruit io...')
91+
# Send SGP30 Data to Adafruit IO.
92+
print('eCO2:', eCO2_data)
93+
aio.send(eCO2_feed.key, eCO2_data)
94+
print('tvoc:', tvoc_data)
95+
aio.send(tvoc_feed.key, tvoc_data)
96+
time.sleep(2)
97+
# Send VEML6070 Data to Adafruit IO.
98+
print('UV Level: ', uv_data)
99+
aio.send(uv_feed.key, uv_data)
100+
time.sleep(2)
101+
# Send BME280 Data to Adafruit IO.
102+
print('Temperature: %0.1f C' % temp_data)
103+
aio.send(temperature_feed.key, temp_data)
104+
print("Humidity: %0.1f %%" % humid_data)
105+
aio.send(humidity_feed.key, int(humid_data))
106+
time.sleep(2)
107+
print("Pressure: %0.1f hPa" % pressure_data)
108+
aio.send(pressure_feed.key, int(pressure_data))
109+
print("Altitude = %0.2f meters" % alt_data)
110+
aio.send(altitude_feed.key, int(alt_data))
111+
# avoid timeout from adafruit io
112+
time.sleep(LOOP_DELAY * 60)
Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,123 @@
1-
// SPDX-FileCopyrightText: 2018 Arduino SA
2-
//
3-
// SPDX-License-Identifier: GPL-2.1-or-later
4-
/*
5-
SerialNINAPassthrough - Use esptool to flash the ESP32 module
6-
For use with PyPortal, Metro M4 WiFi...
7-
8-
Copyright (c) 2018 Arduino SA. All rights reserved.
9-
10-
This library is free software; you can redistribute it and/or
11-
modify it under the terms of the GNU Lesser General Public
12-
License as published by the Free Software Foundation; either
13-
version 2.1 of the License, or (at your option) any later version.
14-
15-
This library is distributed in the hope that it will be useful,
16-
but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18-
Lesser General Public License for more details.
19-
20-
You should have received a copy of the GNU Lesser General Public
21-
License along with this library; if not, write to the Free Software
22-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23-
*/
24-
25-
#include <Adafruit_NeoPixel.h>
26-
27-
unsigned long baud = 115200;
28-
29-
#if defined(ADAFRUIT_FEATHER_M4_EXPRESS) || \
30-
defined(ADAFRUIT_FEATHER_M0_EXPRESS) || \
31-
defined(ARDUINO_AVR_FEATHER32U4) || \
32-
defined(ARDUINO_NRF52840_FEATHER) || \
33-
defined(ADAFRUIT_ITSYBITSY_M0) || \
34-
defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) || \
35-
defined(ARDUINO_AVR_ITSYBITSY32U4_3V) || \
36-
defined(ARDUINO_NRF52_ITSYBITSY)
37-
// Configure the pins used for the ESP32 connection
38-
#define SerialESP32 Serial1
39-
#define SPIWIFI SPI // The SPI port
40-
#define SPIWIFI_SS 13 // Chip select pin
41-
#define ESP32_RESETN 12 // Reset pin
42-
#define SPIWIFI_ACK 11 // a.k.a BUSY or READY pin
43-
#define ESP32_GPIO0 10
44-
#define NEOPIXEL_PIN 8
45-
#elif defined(ARDUINO_AVR_FEATHER328P)
46-
#define SerialESP32 Serial1
47-
#define SPIWIFI SPI // The SPI port
48-
#define SPIWIFI_SS 4 // Chip select pin
49-
#define ESP32_RESETN 3 // Reset pin
50-
#define SPIWIFI_ACK 2 // a.k.a BUSY or READY pin
51-
#define ESP32_GPIO0 -1
52-
#define NEOPIXEL_PIN 8
53-
#elif defined(TEENSYDUINO)
54-
#define SerialESP32 Serial1
55-
#define SPIWIFI SPI // The SPI port
56-
#define SPIWIFI_SS 5 // Chip select pin
57-
#define ESP32_RESETN 6 // Reset pin
58-
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
59-
#define ESP32_GPIO0 -1
60-
#define NEOPIXEL_PIN 8
61-
#elif defined(ARDUINO_NRF52832_FEATHER )
62-
#define SerialESP32 Serial1
63-
#define SPIWIFI SPI // The SPI port
64-
#define SPIWIFI_SS 16 // Chip select pin
65-
#define ESP32_RESETN 15 // Reset pin
66-
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
67-
#define ESP32_GPIO0 -1
68-
#define NEOPIXEL_PIN 8
69-
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
70-
// Don't change the names of these #define's! they match the variant ones
71-
#define SerialESP32 Serial1
72-
#define SPIWIFI SPI
73-
#define SPIWIFI_SS 10 // Chip select pin
74-
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
75-
#define ESP32_RESETN 5 // Reset pin
76-
#define ESP32_GPIO0 -1 // Not connected
77-
#define NEOPIXEL_PIN 8
78-
#endif
79-
80-
#if defined(ADAFRUIT_PYPORTAL)
81-
#define PIN_NEOPIXEL 2
82-
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
83-
#define PIN_NEOPIXEL 40
84-
#endif
85-
86-
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
87-
88-
void setup() {
89-
Serial.begin(baud);
90-
pixel.begin();
91-
pixel.setPixelColor(0, 10, 10, 10); pixel.show();
92-
93-
while (!Serial);
94-
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
95-
96-
delay(100);
97-
SerialESP32.begin(baud);
98-
99-
pinMode(SPIWIFI_SS, OUTPUT);
100-
pinMode(ESP32_GPIO0, OUTPUT);
101-
pinMode(ESP32_RESETN, OUTPUT);
102-
103-
// manually put the ESP32 in upload mode
104-
digitalWrite(ESP32_GPIO0, LOW);
105-
106-
digitalWrite(ESP32_RESETN, LOW);
107-
delay(100);
108-
digitalWrite(ESP32_RESETN, HIGH);
109-
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
110-
delay(100);
111-
}
112-
113-
void loop() {
114-
while (Serial.available()) {
115-
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
116-
SerialESP32.write(Serial.read());
117-
}
118-
119-
while (SerialESP32.available()) {
120-
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
121-
Serial.write(SerialESP32.read());
122-
}
123-
}
1+
// SPDX-FileCopyrightText: 2018 Arduino SA
2+
//
3+
// SPDX-License-Identifier: GPL-2.1-or-later
4+
/*
5+
SerialNINAPassthrough - Use esptool to flash the ESP32 module
6+
For use with PyPortal, Metro M4 WiFi...
7+
8+
Copyright (c) 2018 Arduino SA. All rights reserved.
9+
10+
This library is free software; you can redistribute it and/or
11+
modify it under the terms of the GNU Lesser General Public
12+
License as published by the Free Software Foundation; either
13+
version 2.1 of the License, or (at your option) any later version.
14+
15+
This library is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+
Lesser General Public License for more details.
19+
20+
You should have received a copy of the GNU Lesser General Public
21+
License along with this library; if not, write to the Free Software
22+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23+
*/
24+
25+
#include <Adafruit_NeoPixel.h>
26+
27+
unsigned long baud = 115200;
28+
29+
#if defined(ADAFRUIT_FEATHER_M4_EXPRESS) || \
30+
defined(ADAFRUIT_FEATHER_M0_EXPRESS) || \
31+
defined(ARDUINO_AVR_FEATHER32U4) || \
32+
defined(ARDUINO_NRF52840_FEATHER) || \
33+
defined(ADAFRUIT_ITSYBITSY_M0) || \
34+
defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS) || \
35+
defined(ARDUINO_AVR_ITSYBITSY32U4_3V) || \
36+
defined(ARDUINO_NRF52_ITSYBITSY)
37+
// Configure the pins used for the ESP32 connection
38+
#define SerialESP32 Serial1
39+
#define SPIWIFI SPI // The SPI port
40+
#define SPIWIFI_SS 13 // Chip select pin
41+
#define ESP32_RESETN 12 // Reset pin
42+
#define SPIWIFI_ACK 11 // a.k.a BUSY or READY pin
43+
#define ESP32_GPIO0 10
44+
#define NEOPIXEL_PIN 8
45+
#elif defined(ARDUINO_AVR_FEATHER328P)
46+
#define SerialESP32 Serial1
47+
#define SPIWIFI SPI // The SPI port
48+
#define SPIWIFI_SS 4 // Chip select pin
49+
#define ESP32_RESETN 3 // Reset pin
50+
#define SPIWIFI_ACK 2 // a.k.a BUSY or READY pin
51+
#define ESP32_GPIO0 -1
52+
#define NEOPIXEL_PIN 8
53+
#elif defined(TEENSYDUINO)
54+
#define SerialESP32 Serial1
55+
#define SPIWIFI SPI // The SPI port
56+
#define SPIWIFI_SS 5 // Chip select pin
57+
#define ESP32_RESETN 6 // Reset pin
58+
#define SPIWIFI_ACK 9 // a.k.a BUSY or READY pin
59+
#define ESP32_GPIO0 -1
60+
#define NEOPIXEL_PIN 8
61+
#elif defined(ARDUINO_NRF52832_FEATHER )
62+
#define SerialESP32 Serial1
63+
#define SPIWIFI SPI // The SPI port
64+
#define SPIWIFI_SS 16 // Chip select pin
65+
#define ESP32_RESETN 15 // Reset pin
66+
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
67+
#define ESP32_GPIO0 -1
68+
#define NEOPIXEL_PIN 8
69+
#elif !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
70+
// Don't change the names of these #define's! they match the variant ones
71+
#define SerialESP32 Serial1
72+
#define SPIWIFI SPI
73+
#define SPIWIFI_SS 10 // Chip select pin
74+
#define SPIWIFI_ACK 7 // a.k.a BUSY or READY pin
75+
#define ESP32_RESETN 5 // Reset pin
76+
#define ESP32_GPIO0 -1 // Not connected
77+
#define NEOPIXEL_PIN 8
78+
#endif
79+
80+
#if defined(ADAFRUIT_PYPORTAL)
81+
#define PIN_NEOPIXEL 2
82+
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
83+
#define PIN_NEOPIXEL 40
84+
#endif
85+
86+
Adafruit_NeoPixel pixel = Adafruit_NeoPixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
87+
88+
void setup() {
89+
Serial.begin(baud);
90+
pixel.begin();
91+
pixel.setPixelColor(0, 10, 10, 10); pixel.show();
92+
93+
while (!Serial);
94+
pixel.setPixelColor(0, 50, 50, 50); pixel.show();
95+
96+
delay(100);
97+
SerialESP32.begin(baud);
98+
99+
pinMode(SPIWIFI_SS, OUTPUT);
100+
pinMode(ESP32_GPIO0, OUTPUT);
101+
pinMode(ESP32_RESETN, OUTPUT);
102+
103+
// manually put the ESP32 in upload mode
104+
digitalWrite(ESP32_GPIO0, LOW);
105+
106+
digitalWrite(ESP32_RESETN, LOW);
107+
delay(100);
108+
digitalWrite(ESP32_RESETN, HIGH);
109+
pixel.setPixelColor(0, 20, 20, 0); pixel.show();
110+
delay(100);
111+
}
112+
113+
void loop() {
114+
while (Serial.available()) {
115+
pixel.setPixelColor(0, 10, 0, 0); pixel.show();
116+
SerialESP32.write(Serial.read());
117+
}
118+
119+
while (SerialESP32.available()) {
120+
pixel.setPixelColor(0, 0, 0, 10); pixel.show();
121+
Serial.write(SerialESP32.read());
122+
}
123+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: Unlicense
3+
"""
4+
CircuitPython analog voltage value example
5+
"""
6+
import time
7+
import board
8+
import analogio
9+
10+
analog_pin = analogio.AnalogIn(board.A0)
11+
12+
13+
def get_voltage(pin):
14+
return (pin.value * 2.6) / 51375
15+
16+
17+
while True:
18+
print(get_voltage(analog_pin))
19+
time.sleep(0.1)

0 commit comments

Comments
 (0)