Commit 434b0269 authored by Frank Radzio 's avatar Frank Radzio

Neuer Node Type Funkbarke

parent d53e4178
This diff is collapsed.
......@@ -73,8 +73,7 @@
/**********************************************************
* Notwendige Libs für den BME280
**********************************************************/
#include <Wire.h>
#include "adcvcc.h"
#include <Wire.h>
#include "BME280I2C.h"
/**********************************************************
* Defines
......@@ -89,7 +88,7 @@
// im TRACKINGINTERVAL schaltet den Node aus wenn ihr nicht unterweg seid
// es soll das Netz ja nicht unnötig mit Daten geflutet werden
#define FASTINTERVAL 60 // 60 seconds (for testing)
#define NORMALINTERVAL 900 // (5)15 minutes (normal)
#define NORMALINTERVAL 900 // (5)15 minutes (normal)
/********************************************************
* Pin Mapping RFM95W zu Arduino
......@@ -123,9 +122,9 @@ static const u4_t DEVADDR = 0x000000 ; // LoRaWAN end-device address (DevAddr)
/****************************************************
* OTAA
*
* These callbacks are only used in over-the-air activation, so they are
* left empty here (we cannot leave them out completely unless
* DISABLE_JOIN is set in config.h, otherwise the linker will complain).
* Diese callbacks werden nur für die over-the-air activation verwendet
* hier leer gelassen (wir können sie nicht vollständig auslassen, es sei denn
* DISABLE_JOIN ist in config.h eingestellt, sonst beschwert sich der Linker).
****************************************************/
void os_getArtEui (u1_t* buf) { }
void os_getDevEui (u1_t* buf) { }
......@@ -136,30 +135,29 @@ void os_getDevKey (u1_t* buf) { }
* OTAA Teil
*******************************************************************************/
/*******************************************************************************
* This EUI must be in little-endian format, so least-significant-byte
* first. When copying an EUI from ttnctl output, this means to reverse
* the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
* 0x70.
* Diese EUI muss im Little-Endian-Format vorliegen, also das niederwertigste Byte
* zuerst. Beim Kopieren eines EUI aus der Ausgabe von ttnctl bedeutet dies das Umkehren
* die Bytes Für von TTN ausgegebene EUIs sollten die letzten Bytes 0xD5, 0xB3 sein.
* 0x70.
*******************************************************************************/
static const u1_t PROGMEM APPEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
/*******************************************************************************
* This should also be in little endian format, see above.
* Dies sollte auch im Little-Endian-Format erfolgen, siehe oben.
*******************************************************************************/
static const u1_t PROGMEM DEVEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}
/*******************************************************************************
* This key should be in big endian format (or, since it is not really a
* number but a block of memory, endianness does not really apply). In
* practice, a key taken from ttnctl can be copied as-is.
* The key shown here is the semtech default key.
* Dieser Schlüssel sollte im Big Endian-Format vorliegen (oder, da er nicht wirklich ein
* Nummer, aber ein Speicherblock, Endianness trifft nicht wirklich zu. Im
* In der Praxis kann ein aus ttnctl entnommener Schlüssel so wie er ist kopiert werden.
*******************************************************************************/
static const u1_t PROGMEM APPKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}
#endif
/***************************************************
* global enviromental parameters
* globale Umgebungsparameter
***************************************************/
static osjob_t sendjob;
/***************************************************
......@@ -173,8 +171,7 @@ static float humidity = 0.0;
* Default : forced mode, standby time = 1000 ms
* Oversampling = pressure ×1, temperature ×1, humidity ×1, filter off,
*/
BME280I2C bme; // Default : forced mode, standby time = 1000 ms
// Oversampling = pressure ×1, temperature ×1, humidity ×1, filter off,
BME280I2C bme;
/***************************************************************
* Hier das Sende Intervall festlegen
......@@ -203,6 +200,8 @@ const unsigned TX_INTERVAL = NORMALINTERVAL;
/********************************************************************************
* Variable für die empfangenen Daten
*
* * Diese Variable wird hier erst einmal nicht benötigt
********************************************************************************/
//unsigned char myrecdata[7];
......@@ -215,12 +214,12 @@ Function: ADC_vect
Purpose : IRQ Handler for ADC
Input : -
Output : -
Comments: used for measuring 8 samples low power mode, ADC is then in
free running mode for 8 samples
Comments: Der ADC ist für die Messung von 8 Abtastwerten im Low-Power-Modus vorgesehen
Freilaufmodus für 8 Samples
====================================================================== */
ISR(ADC_vect)
{
// Increment ADC counter
// ADC-Zähler inkrementieren
_adc_irq_cnt++;
}
/*******************************************************************************
......@@ -557,46 +556,5 @@ void setup() {
void loop()
{
// // Start job
// do_send(&sendjob);
// // Wait for response of the queued message (check if message is send correctly)
os_runloop_once();
// // Continue until message is transmitted correctly
// //debugPrintLn("\tWaiting for transmittion\n");
// debugPrintLn(F("W\n"));
// while(LMIC_transmitted != 1)
// {
// os_runloop_once();
// // Add timeout counter when nothing happens:
// LMIC_event_Timeout++;
// delay(1000);
// if (LMIC_event_Timeout >= 60)
// {
// // Timeout when there's no "EV_TXCOMPLETE" event after 60 seconds
// debugPrintLn(F("\tETimeout, msg not tx\n"));
// break;
// }
// }
//
// LMIC_transmitted = 0;
// LMIC_event_Timeout = 0;
//
///********************************************************************************
// * Hier wird der Node in den Schlafmodus gelegt
// *******************************************************************************/
// #ifdef SHOW_DEBUGINFO
// debugPrintLn(F("Going to sleep."));
//#endif
// if (interval > TRACKINGINTERVAL)
// {
// for (int i = 0; i < interval; i++)
// {
// i +=7 ; // no normal 1 second run but 8 second loops m.
// // Enter power down state for 8 s with ADC and BOD module disabled
// LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
// }
// }
//#ifdef SHOW_DEBUGINFO
// debugPrintLn("---");
//#endif
}
This diff is collapsed.
......@@ -42,9 +42,6 @@ Please don't reformat code for the sake of reformatting code. The resulting larg
Things I'd Like To Do But There's No Official Timeline So Please Don't Count On Any Of This Ever Being Canonical:
* For the show() function (with all the delicate pixel timing stuff), break out each architecture into separate source files rather than the current unmaintainable tangle of #ifdef statements!
* Really the only reason I've never incorporated an HSV color function is that I haven't settled on a type and range for the hue element (mathematically an integer from 0 to 1529 yields a "most correct" approach but it's weird to use and would probably annoy people).
* At such time that the prior item is settled (along with the recently-added fill() function in Adafruit_NeoPixel), revisit the DotStar library (and maybe even LPD8806 or anything else we've got) and add the same functions and behaviors so there's a good degree of sketch compatibility across different pixel types.
* I wouldn't mind paring down strandtest a bit. More diagnostic, less Amiga demo.
* Please don't use updateLength() or updateType() in new code. They should not have been implemented this way (use the C++ 'new' operator with the regular constructor instead) and are only sticking around because of the Prime Directive. setPin() is OK for now though, it's a trick we can use to 'recycle' pixel memory across multiple strips.
* In the M0 and M4 code, use the hardware systick counter for bit timing rather than hand-tweaked NOPs (a temporary kludge at the time because I wasn't reading systick correctly).
* As currently written, brightness scaling is still a "destructive" operation -- pixel values are altered in RAM and the original value as set can't be accurately read back, only approximated, which has been confusing and frustrating to users. It was done this way at the time because NeoPixel timing is strict, AVR microcontrollers (all we had at the time) are limited, and assembly language is hard. All the 32-bit architectures should have no problem handling nondestructive brightness scaling -- calculating each byte immediately before it's sent out the wire, maintaining the original set value in RAM -- the work just hasn't been done. There's a fair chance even the AVR code could manage it with some intense focus. (The DotStar library achieves nondestructive brightness scaling because it doesn't have to manage data timing so carefully...every architecture, even ATtiny, just takes whatever cycles it needs for the multiply/shift operations.)
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 6
#define PIN 6 // On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16
#define NUMPIXELS 16 // Popular NeoPixel ring size
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
// END of Trinket-specific code.
pixels.begin(); // This initializes the NeoPixel library.
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}
void loop() {
pixels.clear(); // Set all pixel colors to 'off'
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 150, 0));
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,150,0)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
// This sketch show how to use "new" operator with Adafruit_NeoPixel library
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library
// This sketch shows use of the "new" operator with Adafruit_NeoPixel.
// It's helpful if you don't know NeoPixel settings at compile time or
// you just want to store this settings in EEPROM
// just want to store this settings in EEPROM or a file on an SD card.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 6
int pin = 6; // On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
int numPixel = 16;
int numPixels = 16; // Popular NeoPixel ring size
// Color order, for more information see https://github.com/adafruit/Adafruit_NeoPixel/blob/master/Adafruit_NeoPixel.h
uint8_t colorOrder = 0x52; //or just use NEO_GBR
// NeoPixel color format & data rate. See the strandtest example for
// information on possible values.
int pixelFormat = NEO_GRB + NEO_KHZ800;
// Define new pointer for NeoPixel
// Rather than declaring the whole NeoPixel object here, we just create
// a pointer for one, which we'll then allocate later...
Adafruit_NeoPixel *pixels;
int delayval = 500; // delay for half a second
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
// END of Trinket-specific code.
// Here is a good place to read numPixel & colorOrder from EEPROM or what ever.
// create a new NeoPixel instance with new values
pixels = new Adafruit_NeoPixel(numPixel, PIN, colorOrder);
pixels->begin(); // This initializes the NeoPixel library.
}
// Right about here is where we could read 'pin', 'numPixels' and/or
// 'pixelFormat' from EEPROM or a file on SD or whatever. This is a simple
// example and doesn't do that -- those variables are just set to fixed
// values at the top of this code -- but this is where it would happen.
void loop() {
// Then create a new NeoPixel object dynamically with these values:
pixels = new Adafruit_NeoPixel(numPixels, pin, pixelFormat);
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
// Going forward from here, code works almost identically to any other
// NeoPixel example, but instead of the dot operator on function calls
// (e.g. pixels.begin()), we instead use pointer indirection (->) like so:
pixels->begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
// You'll see more of this in the loop() function below.
}
for(int i=0;i<numPixel;i++){
void loop() {
pixels->clear(); // Set all pixel colors to 'off'
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels->setPixelColor(i, pixels->Color(0,150,0)); // Moderately bright green color.
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<numPixels; i++) { // For each pixel...
pixels->show(); // This sends the updated pixel color to the hardware.
// pixels->Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels->setPixelColor(i, pixels->Color(0, 150, 0));
delay(delayval); // Delay for a period of time (in milliseconds).
pixels->show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}
#######################################
# Syntax Coloring Map For Adafruit_NeoPixel
#######################################
#######################################
# Class
#######################################
Adafruit_NeoPixel KEYWORD1
#######################################
# Methods and Functions
# Methods and Functions
#######################################
setPixelColor KEYWORD2
setPin KEYWORD2
setBrightness KEYWORD2
numPixels KEYWORD2
getPixelColor KEYWORD2
Color KEYWORD2
begin KEYWORD2
show KEYWORD2
setPin KEYWORD2
setPixelColor KEYWORD2
fill KEYWORD2
setBrightness KEYWORD2
clear KEYWORD2
updateLength KEYWORD2
updateLength KEYWORD2
updateType KEYWORD2
canShow KEYWORD2
getPixels KEYWORD2
getBrightness KEYWORD2
getBrightness KEYWORD2
getPin KEYWORD2
canShow KEYWORD2
numPixels KEYWORD2
getPixelColor KEYWORD2
sine8 KEYWORD2
gamma8 KEYWORD2
Color KEYWORD2
ColorHSV KEYWORD2
gamma32 KEYWORD2
#######################################
# Constants
......
name=Adafruit NeoPixel
version=1.1.8
version=1.2.1
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for controlling single-wire-based LED pixels and strip.
......
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software< /span>
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Update by K. Townsend (Adafruit Industries) for lighter typedefs, and
* extended sensor support to include color, voltage and current */
#ifndef _ADAFRUIT_SENSOR_H
#define _ADAFRUIT_SENSOR_H
#ifndef ARDUINO
#include <stdint.h>
#elif ARDUINO >= 100
#include "Arduino.h"
#include "Print.h"
#else
#include "WProgram.h"
#endif
/* Intentionally modeled after sensors.h in the Android API:
* https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/sensors.h */
/* Constants */
#define SENSORS_GRAVITY_EARTH (9.80665F) /**< Earth's gravity in m/s^2 */
#define SENSORS_GRAVITY_MOON (1.6F) /**< The moon's gravity in m/s^2 */
#define SENSORS_GRAVITY_SUN (275.0F) /**< The sun's gravity in m/s^2 */
#define SENSORS_GRAVITY_STANDARD (SENSORS_GRAVITY_EARTH)
#define SENSORS_MAGFIELD_EARTH_MAX (60.0F) /**< Maximum magnetic field on Earth's surface */
#define SENSORS_MAGFIELD_EARTH_MIN (30.0F) /**< Minimum magnetic field on Earth's surface */
#define SENSORS_PRESSURE_SEALEVELHPA (1013.25F) /**< Average sea level pressure is 1013.25 hPa */
#define SENSORS_DPS_TO_RADS (0.017453293F) /**< Degrees/s to rad/s multiplier */
#define SENSORS_GAUSS_TO_MICROTESLA (100) /**< Gauss to micro-Tesla multiplier */
/** Sensor types */
typedef enum
{
SENSOR_TYPE_ACCELEROMETER = (1), /**< Gravity + linear acceleration */
SENSOR_TYPE_MAGNETIC_FIELD = (2),
SENSOR_TYPE_ORIENTATION = (3),
SENSOR_TYPE_GYROSCOPE = (4),
SENSOR_TYPE_LIGHT = (5),
SENSOR_TYPE_PRESSURE = (6),
SENSOR_TYPE_PROXIMITY = (8),
SENSOR_TYPE_GRAVITY = (9),
SENSOR_TYPE_LINEAR_ACCELERATION = (10), /**< Acceleration not including gravity */
SENSOR_TYPE_ROTATION_VECTOR = (11),
SENSOR_TYPE_RELATIVE_HUMIDITY = (12),
SENSOR_TYPE_AMBIENT_TEMPERATURE = (13),
SENSOR_TYPE_VOLTAGE = (15),
SENSOR_TYPE_CURRENT = (16),
SENSOR_TYPE_COLOR = (17)
} sensors_type_t;
/** struct sensors_vec_s is used to return a vector in a common format. */
typedef struct {
union {
float v[3];
struct {
float x;
float y;
float z;
};
/* Orientation sensors */
struct {
float roll; /**< Rotation around the longitudinal axis (the plane body, 'X axis'). Roll is positive and increasing when moving downward. -90°<=roll<=90° */
float pitch; /**< Rotation around the lateral axis (the wing span, 'Y axis'). Pitch is positive and increasing when moving upwards. -180°<=pitch<=180°) */
float heading; /**< Angle between the longitudinal axis (the plane body) and magnetic north, measured clockwise when viewing from the top of the device. 0-359° */
};
};
int8_t status;
uint8_t reserved[3];
} sensors_vec_t;
/** struct sensors_color_s is used to return color data in a common format. */
typedef struct {
union {
float c[3];
/* RGB color space */
struct {
float r; /**< Red component */
float g; /**< Green component */
float b; /**< Blue component */
};
};
uint32_t rgba; /**< 24-bit RGBA value */
} sensors_color_t;
/* Sensor event (36 bytes) */
/** struct sensor_event_s is used to provide a single sensor event in a common format. */
typedef struct
{
int32_t version; /**< must be sizeof(struct sensors_event_t) */
int32_t sensor_id; /**< unique sensor identifier */
int32_t type; /**< sensor type */
int32_t reserved0; /**< reserved */
int32_t timestamp; /**< time is in milliseconds */
union
{
float data[4];
sensors_vec_t acceleration; /**< acceleration values are in meter per second per second (m/s^2) */
sensors_vec_t magnetic; /**< magnetic vector values are in micro-Tesla (uT) */
sensors_vec_t orientation; /**< orientation values are in degrees */
sensors_vec_t gyro; /**< gyroscope values are in rad/s */
float temperature; /**< temperature is in degrees centigrade (Celsius) */
float distance; /**< distance in centimeters */
float light; /**< light in SI lux units */
float pressure; /**< pressure in hectopascal (hPa) */
float relative_humidity; /**< relative humidity in percent */
float current; /**< current in milliamps (mA) */
float voltage; /**< voltage in volts (V) */
sensors_color_t color; /**< color in RGB component values */
};
} sensors_event_t;
/* Sensor details (40 bytes) */
/** struct sensor_s is used to describe basic information about a specific sensor. */
typedef struct
{
char name[12]; /**< sensor name */
int32_t version; /**< version of the hardware + driver */
int32_t sensor_id; /**< unique sensor identifier */
int32_t type; /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */
float max_value; /**< maximum value of this sensor's value in SI units */
float min_value; /**< minimum value of this sensor's value in SI units */
float resolution; /**< smallest difference between two values reported by this sensor */
int32_t min_delay; /**< min delay in microseconds between events. zero = not a constant rate */
} sensor_t;
class Adafruit_Sensor {
public:
// Constructor(s)
Adafruit_Sensor() {}
virtual ~Adafruit_Sensor() {}
// These must be defined by the subclass
virtual void enableAutoRange(bool enabled) { (void)enabled; /* suppress unused warning */ };
virtual bool getEvent(sensors_event_t*) = 0;
virtual void getSensor(sensor_t*) = 0;
private:
bool _autoRange;
};
#endif
This diff is collapsed.
name=Adafruit Unified Sensor
version=1.0.3
author=Adafruit <info@adafruit.com>
maintainer=Adafruit <info@adafruit.com>
sentence=Required for all Adafruit Unified Sensor based libraries.
paragraph=A unified sensor abstraction layer used by many Adafruit sensor libraries.
category=Sensors
url=https://github.com/adafruit/Adafruit_Sensor
architectures=*
includes=Adafruit_Sensor.h
# Adafruit VEML6070 Library [![Build Status](https://travis-ci.org/adafruit/Adafruit_VEML6070.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_VEML6070)
# Adafruit VEML6070 Library [![Build Status](https://travis-ci.com/adafruit/Adafruit_VEML6070.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit_VEML6070)
<img src="https://cdn-shop.adafruit.com/970x728/2899-00.jpg" height="300"/>
......@@ -10,4 +10,4 @@ Check out the links above for our tutorials and wiring diagrams. This chip uses
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
\ No newline at end of file
MIT license, all text above must be included in any redistribution
name=Adafruit VEML6070 Library
version=1.0.1
version=1.0.2
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for VEML6070
......
#include "bsec.h"
// Helper functions declarations
void checkIaqSensorStatus(void);
void errLeds(void);
// Create an object of the class Bsec
Bsec iaqSensor;
String output;
// Entry point for the example
void setup(void)
{
Serial.begin(115200);
iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire);
output = "\nBSEC library version " + String(iaqSensor.version.major) + "." + String(iaqSensor.version.minor) + "." + String(iaqSensor.version.major_bugfix) + "." + String(iaqSensor.version.minor_bugfix);
Serial.println(output);
checkIaqSensorStatus();
bsec_virtual_sensor_t sensorList[10] = {
BSEC_OUTPUT_RAW_TEMPERATURE,
BSEC_OUTPUT_RAW_PRESSURE,
BSEC_OUTPUT_RAW_HUMIDITY,
BSEC_OUTPUT_RAW_GAS,
BSEC_OUTPUT_IAQ,
BSEC_OUTPUT_STATIC_IAQ,
BSEC_OUTPUT_CO2_EQUIVALENT,
BSEC_OUTPUT_BREATH_VOC_EQUIVALENT,
BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,
};
iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_LP);
checkIaqSensorStatus();
// Print the header
output = "Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], Static IAQ, CO2 equivalent, breath VOC equivalent";
Serial.println(output);
}
// Function that is looped forever
void loop(void)
{
unsigned long time_trigger = millis();
if (iaqSensor.run()) { // If new data is available
output = String(time_trigger);
output += ", " + String(iaqSensor.rawTemperature);
output += ", " + String(iaqSensor.pressure);
output += ", " + String(iaqSensor.rawHumidity);
output += ", " + String(iaqSensor.gasResistance);
output += ", " + String(iaqSensor.iaqEstimate);
output += ", " + String(iaqSensor.iaqAccuracy);
output += ", " + String(iaqSensor.temperature);
output += ", " + String(iaqSensor.humidity);
output += ", " + String(iaqSensor.staticIaq);
output += ", " + String(iaqSensor.co2Equivalent);
output += ", " + String(iaqSensor.breathVocEquivalent);
Serial.println(output);
} else {
checkIaqSensorStatus();
}
}
// Helper function definitions
void checkIaqSensorStatus(void)
{
if (iaqSensor.status != BSEC_OK) {
if (iaqSensor.status < BSEC_OK) {
output = "BSEC error code : " + String(iaqSensor.status);
Serial.println(output);
for (;;)
errLeds(); /* Halt in case of failure */
} else {
output = "BSEC warning code : " + String(iaqSensor.status);
Serial.println(output);
}
}
if (iaqSensor.bme680Status != BME680_OK) {
if (iaqSensor.bme680Status < BME680_OK) {
output = "BME680 error code : " + String(iaqSensor.bme680Status);
Serial.println(output);
for (;;)
errLeds(); /* Halt in case of failure */
} else {