-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples for AS7265x and AS7341 spectrometers, with JSON files …
…for use with Serial Studio
- Loading branch information
Showing
4 changed files
with
434 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
{ | ||
"t": "AS7365x", | ||
"g": [ | ||
{ | ||
"t": "Readings", | ||
"d": [ | ||
{ | ||
"t": "395nm", | ||
"v": "%1", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "435nm", | ||
"v": "%2", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "460nm", | ||
"v": "%3", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "485nm", | ||
"v": "%4", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "510nm", | ||
"v": "%5", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "535nm", | ||
"v": "%6", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "560nm", | ||
"v": "%7", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "585nm", | ||
"v": "%8", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "645nm", | ||
"v": "%9", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "705nm", | ||
"v": "%10", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "900nm", | ||
"v": "%11", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "940nm", | ||
"v": "%12", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "610nm", | ||
"v": "%13", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "680nm", | ||
"v": "%14", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "730nm", | ||
"v": "%15", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "760nm", | ||
"v": "%16", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "810nm", | ||
"v": "%17", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
}, | ||
{ | ||
"t": "860nm", | ||
"v": "%18", | ||
"g": true, | ||
"u": "counts", | ||
"w": "bar", | ||
"min": 0, | ||
"max": 65535 | ||
} | ||
] | ||
} | ||
] | ||
} |
76 changes: 76 additions & 0 deletions
76
LightSensors/AS7265x_spectrometer/AS7265x_spectrometer.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
AS7265x spectrometer test | ||
Works with MKR1010, MKR1000, Nano 33 IoT | ||
Uses the following libraries: | ||
http://librarymanager/All#SparkFun_AS7265X (for the sensor) | ||
created 22 Jun 2021 | ||
by Tom Igoe | ||
*/ | ||
// include required libraries and config files | ||
#include <SparkFun_AS7265X.h> | ||
|
||
// initialize the light sensor: | ||
AS7265X sensor; | ||
|
||
void setup() { | ||
Serial.begin(9600); // initialize serial communication | ||
// if serial monitor is not open, wait 3 seconds: | ||
if (!Serial) delay(3000); | ||
if (!sensor.begin()) { | ||
Serial.println("Sensor is not responding. Please check wiring."); | ||
while (true) | ||
; | ||
} | ||
// print header labels: | ||
Serial.println("395nm, 435nm, 460nm, 485nm, 510nm, 535nm, \ | ||
560nm, 585nm, 645nm, 705nm, 900nm, 940nm, \ | ||
610nm, 680nm, 730nm, 760nm, 810nm, 860nm"); | ||
} | ||
|
||
void loop() { | ||
|
||
// Read all 18 channels. This takes several seconds: | ||
sensor.takeMeasurements(); | ||
// print a header: | ||
Serial.print("/* "); | ||
// Print sensor readings: | ||
Serial.print(sensor.getCalibratedA()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedB()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedC()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedD()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedE()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedF()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedG()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedH()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedI()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedJ()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedK()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedL()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedR()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedS()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedT()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedU()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedV()); | ||
Serial.print(","); | ||
Serial.print(sensor.getCalibratedW()); | ||
// print a footer: | ||
Serial.println(" */"); | ||
} |
Oops, something went wrong.