Commit 4253d3b71504257337d916a021489c2bc0d5e9d9
1 parent
4972db79
Le repertoire librairie se trouve dans le repertoire code_arduino, anciennement code arduino.
Showing
23 changed files
with
0 additions
and
2038 deletions
Show diff stats
code arduino/Test IMA3 P2/test/test.ino deleted
... | ... | @@ -1,36 +0,0 @@ |
1 | -/* Utilisation du capteur Ultrason HC-SR04 */ | |
2 | - | |
3 | -// définition des broches utilisées | |
4 | -int trig1 = 7; | |
5 | -int echo1 = 6; | |
6 | - | |
7 | -int trig2 = 8; | |
8 | -int echo2 = 5; | |
9 | -long lecture_echo; | |
10 | -long cm; | |
11 | - | |
12 | -void setup() | |
13 | -{ | |
14 | - pinMode(trig1, OUTPUT); | |
15 | - digitalWrite(trig1, LOW); | |
16 | - pinMode(echo1, INPUT); | |
17 | - | |
18 | - pinMode(trig2, OUTPUT); | |
19 | - digitalWrite(trig2, LOW); | |
20 | - pinMode(echo2, INPUT); | |
21 | - Serial.begin(9600); | |
22 | -} | |
23 | - | |
24 | -void loop() | |
25 | -{ | |
26 | - digitalWrite(trig1, HIGH); | |
27 | - digitalWrite(trig2, HIGH); | |
28 | - delayMicroseconds(10); | |
29 | - digitalWrite(trig1, LOW); | |
30 | - digitalWrite(trig2, LOW); | |
31 | - lecture_echo = pulseIn(echo2, HIGH); | |
32 | - cm = lecture_echo / 58; | |
33 | - Serial.print("Distancem : "); | |
34 | - Serial.println(cm); | |
35 | - delay(500); | |
36 | -} |
code arduino/Test IMA3 P2/testCapteur/testCapteur.ino deleted
... | ... | @@ -1,42 +0,0 @@ |
1 | - #include "Adafruit_BME280.h" | |
2 | - #include "Adafruit_Sensor.h" | |
3 | - //Library allows either I2C or SPI, so include both. | |
4 | - #include "Wire.h" | |
5 | - #include "SPI.h" | |
6 | - | |
7 | - BME280 capteur; | |
8 | - | |
9 | - void setup() { | |
10 | - | |
11 | - Serial.begin(9600); | |
12 | - while (!Serial) { | |
13 | - // Attente de l'ouverture du port série pour Arduino LEONARDO | |
14 | - } | |
15 | - //configuration du capteur | |
16 | - capteur.settings.commInterface = I2C_MODE; | |
17 | - capteur.settings.I2CAddress = 0x76; | |
18 | - capteur.settings.runMode = 3; | |
19 | - capteur.settings.tStandby = 0; | |
20 | - capteur.settings.filter = 0; | |
21 | - capteur.settings.tempOverSample = 1 ; | |
22 | - capteur.settings.pressOverSample = 1; | |
23 | - capteur.settings.humidOverSample = 1; | |
24 | - | |
25 | - Serial.println("Starting BME280... "); | |
26 | - delay(10); // attente de la mise en route du capteur. 2 ms minimum | |
27 | - // chargement de la configuration du capteur | |
28 | - capteur.begin(); | |
29 | - } | |
30 | - | |
31 | - void loop() { | |
32 | - Serial.print("Température: "); | |
33 | - Serial.print(capteur.readTempC(), 2); | |
34 | - Serial.print(" °C"); | |
35 | - Serial.print("\t Pression: "); | |
36 | - Serial.print(capteur.readFloatPressure(), 2); | |
37 | - Serial.print(" Pa"); | |
38 | - Serial.print("\t humidité relative : "); | |
39 | - Serial.print(capteur.readFloatHumidity(), 2); | |
40 | - Serial.println(" %"); | |
41 | - delay(1000); | |
42 | - } |
code arduino/com_Xbee/code_emetteur/sketch_may02a.ino deleted
... | ... | @@ -1,20 +0,0 @@ |
1 | -/* Input-side (button) Arduino code */ | |
2 | -#include <SoftwareSerial.h> | |
3 | -// RX: Arduino pin 2, XBee pin DOUT. TX: Arduino pin 3, XBee pin DIN | |
4 | -SoftwareSerial xBee(2, 3); | |
5 | - | |
6 | -void setup() | |
7 | -{ | |
8 | - // Baud rate MUST match XBee settings (as set in XCTU) | |
9 | - xBee.begin(9600); | |
10 | -} | |
11 | - | |
12 | -void loop() | |
13 | -{ | |
14 | - | |
15 | - xBee.write('H'); | |
16 | - xBee.println("test"); | |
17 | - delay(500); | |
18 | - xBee.write('L'); | |
19 | -} | |
20 | - |
code arduino/com_Xbee/code_receveur/receveurXbee.ino deleted
... | ... | @@ -1,33 +0,0 @@ |
1 | -/* Output-side (LED) Arduino code */ | |
2 | -#include "SoftwareSerial.h" | |
3 | -// RX: Arduino pin 2, XBee pin DOUT. TX: Arduino pin 3, XBee pin DIN | |
4 | -SoftwareSerial XBee(0, 1); | |
5 | -int LED = 13; | |
6 | - | |
7 | -void setup() | |
8 | -{ | |
9 | - // Baud rate MUST match XBee settings (as set in XCTU) | |
10 | - XBee.begin(9600); | |
11 | - pinMode(LED, OUTPUT); | |
12 | -} | |
13 | - | |
14 | -void loop() | |
15 | -{ | |
16 | - if (XBee.available()) | |
17 | - { | |
18 | - char c = XBee.read(); | |
19 | - if (c == 'H') | |
20 | - { | |
21 | - digitalWrite(LED, HIGH); | |
22 | - delay(50); | |
23 | - } | |
24 | - else | |
25 | - { | |
26 | - digitalWrite(LED, LOW); | |
27 | - } | |
28 | - } | |
29 | - else | |
30 | - { | |
31 | - digitalWrite(LED, LOW); | |
32 | - } | |
33 | -} |
code arduino/com_Xbee/progC_initialisation_Xbee/Makefile deleted
... | ... | @@ -1,27 +0,0 @@ |
1 | -# | |
2 | -# Makefile de l'utilitaire XBee | |
3 | -# | |
4 | - | |
5 | -OBJS = xbee.o xbeeATCmd.o | |
6 | - | |
7 | -# | |
8 | -# Cible generale | |
9 | -# | |
10 | - | |
11 | -all: xbee | |
12 | - | |
13 | -# | |
14 | -# La cible de nettoyage | |
15 | -# | |
16 | - | |
17 | -clean: | |
18 | - rm -f core *.o xbee | |
19 | - | |
20 | -# | |
21 | -# Les cibles pour l'executable | |
22 | -# | |
23 | - | |
24 | -xbee: $(OBJS) | |
25 | - $(CC) $(CFLAGS) -o xbee $(OBJS) | |
26 | - | |
27 | -xbeeATCmd.o: xbeeATCmd.c xbeeATCmd.h |
code arduino/com_Xbee/progC_initialisation_Xbee/xbee deleted
No preview for this file type
code arduino/com_Xbee/progC_initialisation_Xbee/xbee.c deleted
... | ... | @@ -1,96 +0,0 @@ |
1 | -/** fichier xbee.c **/ | |
2 | - | |
3 | -/*****************************************************************/ | |
4 | -/** Utilitaire pour configurer les modules XBee. **/ | |
5 | -/*****************************************************************/ | |
6 | - | |
7 | -/** Fichiers d'inclusion **/ | |
8 | - | |
9 | -#include <stdio.h> | |
10 | -#include <stdlib.h> | |
11 | -#include <string.h> | |
12 | -#include <unistd.h> | |
13 | -#include <termios.h> | |
14 | -#include <netdb.h> | |
15 | -#include <netinet/in.h> | |
16 | -#include <sys/types.h> | |
17 | -#include <sys/stat.h> | |
18 | -#include <fcntl.h> | |
19 | - | |
20 | -#include "xbeeATCmd.h" | |
21 | - | |
22 | -/** Constantes **/ | |
23 | - | |
24 | -#define SERIALDEV "/dev/ttyUSB0" | |
25 | -#define BAUDRATE B9600 | |
26 | - | |
27 | -/**** Variables globales *****/ | |
28 | - | |
29 | -static struct termios sauvegarde; | |
30 | - | |
31 | -/** Ouverture d'un port serie **/ | |
32 | - | |
33 | -int ouvertureSerie(char *periph,int vitesse) | |
34 | -{ | |
35 | -struct termios nouveau; | |
36 | -int df=open(periph,O_RDWR|O_NOCTTY); | |
37 | -if(df<0) return -1; | |
38 | - | |
39 | -tcgetattr(df,&sauvegarde); /* save current port settings */ | |
40 | -bzero(&nouveau,sizeof(nouveau)); | |
41 | -nouveau.c_cflag=CLOCAL|CREAD|vitesse|CS8; | |
42 | -nouveau.c_iflag=0; | |
43 | -nouveau.c_oflag=0; | |
44 | -nouveau.c_lflag=0; | |
45 | -nouveau.c_cc[VTIME]=0; | |
46 | -nouveau.c_cc[VMIN]=1; | |
47 | -tcflush(df, TCIFLUSH); | |
48 | -tcsetattr(df,TCSANOW,&nouveau); | |
49 | - | |
50 | -return df; | |
51 | -} | |
52 | - | |
53 | -/** Fermeture d'un port serie **/ | |
54 | - | |
55 | -void fermetureSerie(int df) | |
56 | -{ | |
57 | -tcsetattr(df,TCSANOW,&sauvegarde); | |
58 | -close(df); | |
59 | -} | |
60 | - | |
61 | -/** Programme principal **/ | |
62 | - | |
63 | -int main(int argc, char *argv[]) | |
64 | -{ | |
65 | - | |
66 | -int ds; | |
67 | -ds=ouvertureSerie(SERIALDEV,BAUDRATE); | |
68 | -if(ds<0){ | |
69 | - fprintf(stderr,"Erreur sur la connexion série.\n"); | |
70 | - exit(-1); | |
71 | - } | |
72 | - | |
73 | -fprintf(stdout,"Configuration actuelle :\n"); | |
74 | -fprintf(stdout,"----------------------\n"); | |
75 | -xbeeModeCommande(ds); | |
76 | -xbeeRecupereVitesse(ds); | |
77 | -xbeeRecupereCanal(ds); | |
78 | - | |
79 | -fprintf(stdout,"\nConfiguration par défaut :\n"); | |
80 | -fprintf(stdout,"------------------------\n"); | |
81 | -xbeeDefaut(ds); | |
82 | -xbeeRecupereVitesse(ds); | |
83 | -xbeeRecupereCanal(ds); | |
84 | - | |
85 | -fprintf(stdout,"\nConfiguration spécifique :\n"); | |
86 | -fprintf(stdout,"------------------------\n"); | |
87 | -xbeeConfigureVitesse(ds,XBEE_VITESSE_9600); | |
88 | -xbeeConfigureCanal(ds,0x0B); | |
89 | -xbeeRecupereVitesse(ds); | |
90 | -xbeeRecupereCanal(ds); | |
91 | -xbeeSauver(ds); | |
92 | -xbeeSortir(ds); | |
93 | - | |
94 | -fermetureSerie(ds); | |
95 | -return EXIT_SUCCESS; | |
96 | -} |
code arduino/com_Xbee/progC_initialisation_Xbee/xbee.o deleted
No preview for this file type
code arduino/com_Xbee/progC_initialisation_Xbee/xbeeATCmd.c deleted
... | ... | @@ -1,132 +0,0 @@ |
1 | -/** fichier xbeeATCmd.c **/ | |
2 | - | |
3 | -/*****************************************************************/ | |
4 | -/** Commandes pour configurer les modules XBee. **/ | |
5 | -/*****************************************************************/ | |
6 | - | |
7 | -/** Fichiers d'inclusion **/ | |
8 | - | |
9 | -#include <stdio.h> | |
10 | -#include <stdlib.h> | |
11 | -#include <string.h> | |
12 | -#include <unistd.h> | |
13 | - | |
14 | -/** Constantes **/ | |
15 | - | |
16 | -#define TAILLE_TAMPON 128 | |
17 | - | |
18 | -/** Fonctions **/ | |
19 | - | |
20 | -void xbeeReponse(int ds) | |
21 | -{ | |
22 | -register int i; | |
23 | -char d[TAILLE_TAMPON]; | |
24 | -sync(); | |
25 | -for(i=0;i<TAILLE_TAMPON;i++){ | |
26 | - if(read(ds,d+i,1)!=1){ perror("xbeeReponse.read"); exit(-1); } | |
27 | - if(d[i]==0x0d) break; | |
28 | - } | |
29 | -int size=i; | |
30 | -for(i=0;i<size;i++) | |
31 | - if(d[i]!=0x0d) fprintf(stdout,"%c",d[i]); | |
32 | -if(size>0) fprintf(stdout," ("); | |
33 | -for(i=0;i<size;i++){ | |
34 | - fprintf(stdout,"%.2x",d[i]); | |
35 | - if(i<size-1) fprintf(stdout," "); | |
36 | - } | |
37 | -if(size>0) fprintf(stdout,")\n"); | |
38 | -} | |
39 | - | |
40 | -void xbeeDefaut(int ds) | |
41 | -{ | |
42 | -#ifdef DEBUG | |
43 | -printf("{xbeeDefaut}\n"); | |
44 | -#endif | |
45 | -char* d="ATRE\r"; | |
46 | -write(ds,d,strlen(d)); | |
47 | -xbeeReponse(ds); | |
48 | -} | |
49 | - | |
50 | -void xbeeSauver(int ds) | |
51 | -{ | |
52 | -#ifdef DEBUG | |
53 | -printf("{xbeeSauver}\n"); | |
54 | -#endif | |
55 | -char* d="ATWR\r"; | |
56 | -write(ds,d,strlen(d)); | |
57 | -xbeeReponse(ds); | |
58 | -} | |
59 | - | |
60 | -void xbeeSortir(int ds) | |
61 | -{ | |
62 | -#ifdef DEBUG | |
63 | -printf("{xbeeSortir}\n"); | |
64 | -#endif | |
65 | -char *cmd="ATCN\r"; | |
66 | -write(ds,cmd,strlen(cmd)); | |
67 | -xbeeReponse(ds); | |
68 | -} | |
69 | - | |
70 | -void xbeeConfigureVitesse(int ds,unsigned char vitesse) | |
71 | -{ | |
72 | -#ifdef DEBUG | |
73 | -printf("{xbeeConfigureVitesse %d}\n",vitesse); | |
74 | -#endif | |
75 | -if(vitesse<0 || vitesse>7) return; | |
76 | -char cmd[TAILLE_TAMPON]; | |
77 | -sprintf(cmd,"ATBD %x\r",vitesse); | |
78 | -write(ds,cmd,strlen(cmd)); | |
79 | -xbeeReponse(ds); | |
80 | -} | |
81 | - | |
82 | -void xbeeRecupereVitesse(int ds) | |
83 | -{ | |
84 | -#ifdef DEBUG | |
85 | -printf("{xbeeRecupereVitesse}\n"); | |
86 | -#endif | |
87 | -char *cmd="ATBD\r"; | |
88 | -write(ds,cmd,strlen(cmd)); | |
89 | -xbeeReponse(ds); | |
90 | -} | |
91 | - | |
92 | -/* Parametre canal entre 0x0B et 0x1A */ | |
93 | -void xbeeConfigureCanal(int ds,char canal) | |
94 | -{ | |
95 | -#ifdef DEBUG | |
96 | -printf("{xbeeConfigureCanal %02x} : debut\n",canal); | |
97 | -#endif | |
98 | -char cmd[TAILLE_TAMPON]; | |
99 | -sprintf(cmd,"ATCH %x\r",canal); | |
100 | -sync(); | |
101 | -write(ds,cmd,strlen(cmd)); | |
102 | -xbeeReponse(ds); | |
103 | -#ifdef DEBUG | |
104 | -printf("{xbeeConfigureCanal} : fin\n"); | |
105 | -#endif | |
106 | -} | |
107 | - | |
108 | -void xbeeRecupereCanal(int ds) | |
109 | -{ | |
110 | -#ifdef DEBUG | |
111 | -printf("{xbeeRecupereCanal} : debut\n"); | |
112 | -#endif | |
113 | -char *cmd="ATCH\r"; | |
114 | -sync(); | |
115 | -write(ds,cmd,strlen(cmd)); | |
116 | -xbeeReponse(ds); | |
117 | -#ifdef DEBUG | |
118 | -printf("{xbeeRecupereCanal} : fin\n"); | |
119 | -#endif | |
120 | -} | |
121 | - | |
122 | -void xbeeModeCommande(int ds) | |
123 | -{ | |
124 | -#ifdef DEBUG | |
125 | -printf("{xbeeModeCommande}\n"); | |
126 | -#endif | |
127 | -char *cmd="+++"; | |
128 | -sleep(1); | |
129 | -sync(); | |
130 | -write(ds,cmd,strlen(cmd)); | |
131 | -xbeeReponse(ds); | |
132 | -} |
code arduino/com_Xbee/progC_initialisation_Xbee/xbeeATCmd.h deleted
... | ... | @@ -1,28 +0,0 @@ |
1 | -/** fichier xbeeATCmd.h **/ | |
2 | - | |
3 | -/*****************************************************************/ | |
4 | -/** Declarations publiques pour configurer les modules XBee. **/ | |
5 | -/*****************************************************************/ | |
6 | - | |
7 | -/** Constantes **/ | |
8 | - | |
9 | -#define XBEE_VITESSE_1200 0 | |
10 | -#define XBEE_VITESSE_2400 1 | |
11 | -#define XBEE_VITESSE_4800 2 | |
12 | -#define XBEE_VITESSE_9600 3 | |
13 | -#define XBEE_VITESSE_19200 4 | |
14 | -#define XBEE_VITESSE_38400 5 | |
15 | -#define XBEE_VITESSE_57600 6 | |
16 | -#define XBEE_VITESSE_115200 7 | |
17 | - | |
18 | -/** Prototypes **/ | |
19 | - | |
20 | -void xbeeReponse(int ds); | |
21 | -void xbeeDefaut(int ds); | |
22 | -void xbeeSauver(int ds); | |
23 | -void xbeeSortir(int ds); | |
24 | -void xbeeConfigureVitesse(int ds,unsigned char vitesse); | |
25 | -void xbeeRecupereVitesse(int ds); | |
26 | -void xbeeConfigureCanal(int ds,char canal); | |
27 | -void xbeeRecupereCanal(int ds); | |
28 | -void xbeeModeCommande(int ds); |
code arduino/com_Xbee/progC_initialisation_Xbee/xbeeATCmd.o deleted
No preview for this file type
code arduino/test.ino deleted
... | ... | @@ -1,63 +0,0 @@ |
1 | -/* Utilisation du capteur Ultrason HC-SR04 */ | |
2 | - | |
3 | -// définition des broches utilisées | |
4 | -int trigA = 7; | |
5 | -int echoA = 6; | |
6 | - | |
7 | -int trigB = 7; | |
8 | -int echoB = 5; | |
9 | -long timeAB; | |
10 | -long timeBA; | |
11 | -long C; | |
12 | -long V; | |
13 | -long speedofsoundmps = 340; | |
14 | - | |
15 | -void setup() | |
16 | -{ | |
17 | - pinMode(trigA, OUTPUT); | |
18 | - digitalWrite(trigA, LOW); | |
19 | - pinMode(echoA, INPUT); | |
20 | - | |
21 | - pinMode(trigB, OUTPUT); | |
22 | - digitalWrite(trigB, LOW); | |
23 | - pinMode(echoB, INPUT); | |
24 | - Serial.begin(9600); | |
25 | -} | |
26 | - | |
27 | -void loop() | |
28 | -{ | |
29 | - digitalWrite(trigA, LOW); | |
30 | - delayMicroseconds(2); | |
31 | - digitalWrite(trigA, HIGH); | |
32 | - delayMicroseconds(10); | |
33 | - digitalWrite(trigA, LOW); | |
34 | - timeAB = pulseIn(echoB, HIGH); | |
35 | - //timeAB = timeAB-40; | |
36 | - //Serial.println("Temps AB : "); | |
37 | - //Serial.println(timeAB); | |
38 | - | |
39 | - delay(100); | |
40 | - | |
41 | - digitalWrite(trigB, LOW); | |
42 | - delayMicroseconds(2); | |
43 | - digitalWrite(trigB, HIGH); | |
44 | - delayMicroseconds(10); | |
45 | - digitalWrite(trigB, LOW); | |
46 | - timeBA = pulseIn(echoA, HIGH); | |
47 | - //timeBA = timeBA-40; | |
48 | - //Serial.println("Temps BA : "); | |
49 | - //Serial.println(timeBA); | |
50 | - | |
51 | - | |
52 | - C = (0.45/2)*((1e6/timeAB)+(1e6/timeBA)); | |
53 | - V = (0.45/2)*((1e6/timeAB)-(1e6/timeBA)); | |
54 | - //Serial.println("Vitesse c : "); | |
55 | - //Serial.println(C); | |
56 | - //Serial.println() ; | |
57 | - Serial.println("Vitesse du vent V : "); | |
58 | - Serial.println(V); | |
59 | - Serial.println(); | |
60 | - //Serial.println(); | |
61 | - //Serial.println(); | |
62 | - delay(1000); | |
63 | -} |
librairie/adafruit/Adafruit_BME280_Library-master/.github/ISSUE_TEMPLATE.md deleted
... | ... | @@ -1,46 +0,0 @@ |
1 | -Thank you for opening an issue on an Adafruit Arduino library repository. To | |
2 | -improve the speed of resolution please review the following guidelines and | |
3 | -common troubleshooting steps below before creating the issue: | |
4 | - | |
5 | -- **Do not use GitHub issues for troubleshooting projects and issues.** Instead use | |
6 | - the forums at http://forums.adafruit.com to ask questions and troubleshoot why | |
7 | - something isn't working as expected. In many cases the problem is a common issue | |
8 | - that you will more quickly receive help from the forum community. GitHub issues | |
9 | - are meant for known defects in the code. If you don't know if there is a defect | |
10 | - in the code then start with troubleshooting on the forum first. | |
11 | - | |
12 | -- **If following a tutorial or guide be sure you didn't miss a step.** Carefully | |
13 | - check all of the steps and commands to run have been followed. Consult the | |
14 | - forum if you're unsure or have questions about steps in a guide/tutorial. | |
15 | - | |
16 | -- **For Arduino projects check these very common issues to ensure they don't apply**: | |
17 | - | |
18 | - - For uploading sketches or communicating with the board make sure you're using | |
19 | - a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes | |
20 | - very hard to tell the difference between a data and charge cable! Try using the | |
21 | - cable with other devices or swapping to another cable to confirm it is not | |
22 | - the problem. | |
23 | - | |
24 | - - **Be sure you are supplying adequate power to the board.** Check the specs of | |
25 | - your board and plug in an external power supply. In many cases just | |
26 | - plugging a board into your computer is not enough to power it and other | |
27 | - peripherals. | |
28 | - | |
29 | - - **Double check all soldering joints and connections.** Flakey connections | |
30 | - cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints. | |
31 | - | |
32 | - - **Ensure you are using an official Arduino or Adafruit board.** We can't | |
33 | - guarantee a clone board will have the same functionality and work as expected | |
34 | - with this code and don't support them. | |
35 | - | |
36 | -If you're sure this issue is a defect in the code and checked the steps above | |
37 | -please fill in the following fields to provide enough troubleshooting information. | |
38 | -You may delete the guideline and text above to just leave the following details: | |
39 | - | |
40 | -- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE** | |
41 | - | |
42 | -- Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO | |
43 | - VERSION HERE** | |
44 | - | |
45 | -- List the steps to reproduce the problem below (if possible attach a sketch or | |
46 | - copy the sketch code in too): **LIST REPRO STEPS BELOW** |
librairie/adafruit/Adafruit_BME280_Library-master/.github/PULL_REQUEST_TEMPLATE.md deleted
... | ... | @@ -1,26 +0,0 @@ |
1 | -Thank you for creating a pull request to contribute to Adafruit's GitHub code! | |
2 | -Before you open the request please review the following guidelines and tips to | |
3 | -help it be more easily integrated: | |
4 | - | |
5 | -- **Describe the scope of your change--i.e. what the change does and what parts | |
6 | - of the code were modified.** This will help us understand any risks of integrating | |
7 | - the code. | |
8 | - | |
9 | -- **Describe any known limitations with your change.** For example if the change | |
10 | - doesn't apply to a supported platform of the library please mention it. | |
11 | - | |
12 | -- **Please run any tests or examples that can exercise your modified code.** We | |
13 | - strive to not break users of the code and running tests/examples helps with this | |
14 | - process. | |
15 | - | |
16 | -Thank you again for contributing! We will try to test and integrate the change | |
17 | -as soon as we can, but be aware we have many GitHub repositories to manage and | |
18 | -can't immediately respond to every request. There is no need to bump or check in | |
19 | -on a pull request (it will clutter the discussion of the request). | |
20 | - | |
21 | -Also don't be worried if the request is closed or not integrated--sometimes the | |
22 | -priorities of Adafruit's GitHub code (education, ease of use) might not match the | |
23 | -priorities of the pull request. Don't fret, the open source community thrives on | |
24 | -forks and GitHub makes it easy to keep your changes in a forked repo. | |
25 | - | |
26 | -After reviewing the guidelines above you can delete this text from the pull request. |
librairie/adafruit/Adafruit_BME280_Library-master/Adafruit_BME280.cpp deleted
... | ... | @@ -1,502 +0,0 @@ |
1 | -/*************************************************************************** | |
2 | - This is a library for the BME280 humidity, temperature & pressure sensor | |
3 | - | |
4 | - Designed specifically to work with the Adafruit BME280 Breakout | |
5 | - ----> http://www.adafruit.com/products/2650 | |
6 | - | |
7 | - These sensors use I2C or SPI to communicate, 2 or 4 pins are required | |
8 | - to interface. | |
9 | - | |
10 | - Adafruit invests time and resources providing this open source code, | |
11 | - please support Adafruit andopen-source hardware by purchasing products | |
12 | - from Adafruit! | |
13 | - | |
14 | - Written by Limor Fried & Kevin Townsend for Adafruit Industries. | |
15 | - BSD license, all text above must be included in any redistribution | |
16 | - ***************************************************************************/ | |
17 | -#include "Arduino.h" | |
18 | -#include <Wire.h> | |
19 | -#include <SPI.h> | |
20 | -#include "Adafruit_BME280.h" | |
21 | - | |
22 | -/*************************************************************************** | |
23 | - PRIVATE FUNCTIONS | |
24 | - ***************************************************************************/ | |
25 | -Adafruit_BME280::Adafruit_BME280() | |
26 | - : _cs(-1), _mosi(-1), _miso(-1), _sck(-1) | |
27 | -{ } | |
28 | - | |
29 | -Adafruit_BME280::Adafruit_BME280(int8_t cspin) | |
30 | - : _cs(cspin), _mosi(-1), _miso(-1), _sck(-1) | |
31 | -{ } | |
32 | - | |
33 | -Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) | |
34 | - : _cs(cspin), _mosi(mosipin), _miso(misopin), _sck(sckpin) | |
35 | -{ } | |
36 | - | |
37 | - | |
38 | -/**************************************************************************/ | |
39 | -/*! | |
40 | - @brief Initialise sensor with given parameters / settings | |
41 | -*/ | |
42 | -/**************************************************************************/ | |
43 | -bool Adafruit_BME280::begin(uint8_t addr) | |
44 | -{ | |
45 | - _i2caddr = addr; | |
46 | - | |
47 | - // init I2C or SPI sensor interface | |
48 | - if (_cs == -1) { | |
49 | - // I2C | |
50 | - Wire.begin(); | |
51 | - } else { | |
52 | - digitalWrite(_cs, HIGH); | |
53 | - pinMode(_cs, OUTPUT); | |
54 | - if (_sck == -1) { | |
55 | - // hardware SPI | |
56 | - SPI.begin(); | |
57 | - } else { | |
58 | - // software SPI | |
59 | - pinMode(_sck, OUTPUT); | |
60 | - pinMode(_mosi, OUTPUT); | |
61 | - pinMode(_miso, INPUT); | |
62 | - } | |
63 | - } | |
64 | - | |
65 | - // check if sensor, i.e. the chip ID is correct | |
66 | - if (read8(BME280_REGISTER_CHIPID) != 0x60) | |
67 | - return false; | |
68 | - | |
69 | - // reset the device using soft-reset | |
70 | - // this makes sure the IIR is off, etc. | |
71 | - write8(BME280_REGISTER_SOFTRESET, 0xB6); | |
72 | - | |
73 | - // wait for chip to wake up. | |
74 | - delay(300); | |
75 | - | |
76 | - // if chip is still reading calibration, delay | |
77 | - while (isReadingCalibration()) | |
78 | - delay(100); | |
79 | - | |
80 | - readCoefficients(); // read trimming parameters, see DS 4.2.2 | |
81 | - | |
82 | - setSampling(); // use defaults | |
83 | - | |
84 | - return true; | |
85 | -} | |
86 | - | |
87 | -/**************************************************************************/ | |
88 | -/*! | |
89 | - @brief setup sensor with given parameters / settings | |
90 | - | |
91 | - This is simply a overload to the normal begin()-function, so SPI users | |
92 | - don't get confused about the library requiring an address. | |
93 | -*/ | |
94 | -/**************************************************************************/ | |
95 | - | |
96 | - | |
97 | -void Adafruit_BME280::setSampling(sensor_mode mode, | |
98 | - sensor_sampling tempSampling, | |
99 | - sensor_sampling pressSampling, | |
100 | - sensor_sampling humSampling, | |
101 | - sensor_filter filter, | |
102 | - standby_duration duration) { | |
103 | - _measReg.mode = mode; | |
104 | - _measReg.osrs_t = tempSampling; | |
105 | - _measReg.osrs_p = pressSampling; | |
106 | - | |
107 | - | |
108 | - _humReg.osrs_h = humSampling; | |
109 | - _configReg.filter = filter; | |
110 | - _configReg.t_sb = duration; | |
111 | - | |
112 | - | |
113 | - // you must make sure to also set REGISTER_CONTROL after setting the | |
114 | - // CONTROLHUMID register, otherwise the values won't be applied (see DS 5.4.3) | |
115 | - write8(BME280_REGISTER_CONTROLHUMID, _humReg.get()); | |
116 | - write8(BME280_REGISTER_CONFIG, _configReg.get()); | |
117 | - write8(BME280_REGISTER_CONTROL, _measReg.get()); | |
118 | -} | |
119 | - | |
120 | - | |
121 | -/**************************************************************************/ | |
122 | -/*! | |
123 | - @brief Encapsulate hardware and software SPI transfer into one function | |
124 | -*/ | |
125 | -/**************************************************************************/ | |
126 | -uint8_t Adafruit_BME280::spixfer(uint8_t x) { | |
127 | - // hardware SPI | |
128 | - if (_sck == -1) | |
129 | - return SPI.transfer(x); | |
130 | - | |
131 | - // software SPI | |
132 | - uint8_t reply = 0; | |
133 | - for (int i=7; i>=0; i--) { | |
134 | - reply <<= 1; | |
135 | - digitalWrite(_sck, LOW); | |
136 | - digitalWrite(_mosi, x & (1<<i)); | |
137 | - digitalWrite(_sck, HIGH); | |
138 | - if (digitalRead(_miso)) | |
139 | - reply |= 1; | |
140 | - } | |
141 | - return reply; | |
142 | -} | |
143 | - | |
144 | - | |
145 | -/**************************************************************************/ | |
146 | -/*! | |
147 | - @brief Writes an 8 bit value over I2C or SPI | |
148 | -*/ | |
149 | -/**************************************************************************/ | |
150 | -void Adafruit_BME280::write8(byte reg, byte value) { | |
151 | - if (_cs == -1) { | |
152 | - Wire.beginTransmission((uint8_t)_i2caddr); | |
153 | - Wire.write((uint8_t)reg); | |
154 | - Wire.write((uint8_t)value); | |
155 | - Wire.endTransmission(); | |
156 | - } else { | |
157 | - if (_sck == -1) | |
158 | - SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); | |
159 | - digitalWrite(_cs, LOW); | |
160 | - spixfer(reg & ~0x80); // write, bit 7 low | |
161 | - spixfer(value); | |
162 | - digitalWrite(_cs, HIGH); | |
163 | - if (_sck == -1) | |
164 | - SPI.endTransaction(); // release the SPI bus | |
165 | - } | |
166 | -} | |
167 | - | |
168 | - | |
169 | -/**************************************************************************/ | |
170 | -/*! | |
171 | - @brief Reads an 8 bit value over I2C or SPI | |
172 | -*/ | |
173 | -/**************************************************************************/ | |
174 | -uint8_t Adafruit_BME280::read8(byte reg) { | |
175 | - uint8_t value; | |
176 | - | |
177 | - if (_cs == -1) { | |
178 | - Wire.beginTransmission((uint8_t)_i2caddr); | |
179 | - Wire.write((uint8_t)reg); | |
180 | - Wire.endTransmission(); | |
181 | - Wire.requestFrom((uint8_t)_i2caddr, (byte)1); | |
182 | - value = Wire.read(); | |
183 | - } else { | |
184 | - if (_sck == -1) | |
185 | - SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); | |
186 | - digitalWrite(_cs, LOW); | |
187 | - spixfer(reg | 0x80); // read, bit 7 high | |
188 | - value = spixfer(0); | |
189 | - digitalWrite(_cs, HIGH); | |
190 | - if (_sck == -1) | |
191 | - SPI.endTransaction(); // release the SPI bus | |
192 | - } | |
193 | - return value; | |
194 | -} | |
195 | - | |
196 | - | |
197 | -/**************************************************************************/ | |
198 | -/*! | |
199 | - @brief Reads a 16 bit value over I2C or SPI | |
200 | -*/ | |
201 | -/**************************************************************************/ | |
202 | -uint16_t Adafruit_BME280::read16(byte reg) | |
203 | -{ | |
204 | - uint16_t value; | |
205 | - | |
206 | - if (_cs == -1) { | |
207 | - Wire.beginTransmission((uint8_t)_i2caddr); | |
208 | - Wire.write((uint8_t)reg); | |
209 | - Wire.endTransmission(); | |
210 | - Wire.requestFrom((uint8_t)_i2caddr, (byte)2); | |
211 | - value = (Wire.read() << 8) | Wire.read(); | |
212 | - } else { | |
213 | - if (_sck == -1) | |
214 | - SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); | |
215 | - digitalWrite(_cs, LOW); | |
216 | - spixfer(reg | 0x80); // read, bit 7 high | |
217 | - value = (spixfer(0) << 8) | spixfer(0); | |
218 | - digitalWrite(_cs, HIGH); | |
219 | - if (_sck == -1) | |
220 | - SPI.endTransaction(); // release the SPI bus | |
221 | - } | |
222 | - | |
223 | - return value; | |
224 | -} | |
225 | - | |
226 | - | |
227 | -/**************************************************************************/ | |
228 | -/*! | |
229 | - | |
230 | -*/ | |
231 | -/**************************************************************************/ | |
232 | -uint16_t Adafruit_BME280::read16_LE(byte reg) { | |
233 | - uint16_t temp = read16(reg); | |
234 | - return (temp >> 8) | (temp << 8); | |
235 | -} | |
236 | - | |
237 | - | |
238 | -/**************************************************************************/ | |
239 | -/*! | |
240 | - @brief Reads a signed 16 bit value over I2C or SPI | |
241 | -*/ | |
242 | -/**************************************************************************/ | |
243 | -int16_t Adafruit_BME280::readS16(byte reg) | |
244 | -{ | |
245 | - return (int16_t)read16(reg); | |
246 | -} | |
247 | - | |
248 | - | |
249 | -/**************************************************************************/ | |
250 | -/*! | |
251 | - | |
252 | -*/ | |
253 | -/**************************************************************************/ | |
254 | -int16_t Adafruit_BME280::readS16_LE(byte reg) | |
255 | -{ | |
256 | - return (int16_t)read16_LE(reg); | |
257 | -} | |
258 | - | |
259 | - | |
260 | -/**************************************************************************/ | |
261 | -/*! | |
262 | - @brief Reads a 24 bit value over I2C | |
263 | -*/ | |
264 | -/**************************************************************************/ | |
265 | -uint32_t Adafruit_BME280::read24(byte reg) | |
266 | -{ | |
267 | - uint32_t value; | |
268 | - | |
269 | - if (_cs == -1) { | |
270 | - Wire.beginTransmission((uint8_t)_i2caddr); | |
271 | - Wire.write((uint8_t)reg); | |
272 | - Wire.endTransmission(); | |
273 | - Wire.requestFrom((uint8_t)_i2caddr, (byte)3); | |
274 | - | |
275 | - value = Wire.read(); | |
276 | - value <<= 8; | |
277 | - value |= Wire.read(); | |
278 | - value <<= 8; | |
279 | - value |= Wire.read(); | |
280 | - } else { | |
281 | - if (_sck == -1) | |
282 | - SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); | |
283 | - digitalWrite(_cs, LOW); | |
284 | - spixfer(reg | 0x80); // read, bit 7 high | |
285 | - | |
286 | - value = spixfer(0); | |
287 | - value <<= 8; | |
288 | - value |= spixfer(0); | |
289 | - value <<= 8; | |
290 | - value |= spixfer(0); | |
291 | - | |
292 | - digitalWrite(_cs, HIGH); | |
293 | - if (_sck == -1) | |
294 | - SPI.endTransaction(); // release the SPI bus | |
295 | - } | |
296 | - | |
297 | - return value; | |
298 | -} | |
299 | - | |
300 | - | |
301 | -/**************************************************************************/ | |
302 | -/*! | |
303 | - @brief Take a new measurement (only possible in forced mode) | |
304 | -*/ | |
305 | -/**************************************************************************/ | |
306 | -void Adafruit_BME280::takeForcedMeasurement() | |
307 | -{ | |
308 | - // If we are in forced mode, the BME sensor goes back to sleep after each | |
309 | - // measurement and we need to set it to forced mode once at this point, so | |
310 | - // it will take the next measurement and then return to sleep again. | |
311 | - // In normal mode simply does new measurements periodically. | |
312 | - if (_measReg.mode == MODE_FORCED) { | |
313 | - // set to forced mode, i.e. "take next measurement" | |
314 | - write8(BME280_REGISTER_CONTROL, _measReg.get()); | |
315 | - // wait until measurement has been completed, otherwise we would read | |
316 | - // the values from the last measurement | |
317 | - while (read8(BME280_REGISTER_STATUS) & 0x08) | |
318 | - delay(1); | |
319 | - } | |
320 | -} | |
321 | - | |
322 | - | |
323 | -/**************************************************************************/ | |
324 | -/*! | |
325 | - @brief Reads the factory-set coefficients | |
326 | -*/ | |
327 | -/**************************************************************************/ | |
328 | -void Adafruit_BME280::readCoefficients(void) | |
329 | -{ | |
330 | - _bme280_calib.dig_T1 = read16_LE(BME280_REGISTER_DIG_T1); | |
331 | - _bme280_calib.dig_T2 = readS16_LE(BME280_REGISTER_DIG_T2); | |
332 | - _bme280_calib.dig_T3 = readS16_LE(BME280_REGISTER_DIG_T3); | |
333 | - | |
334 | - _bme280_calib.dig_P1 = read16_LE(BME280_REGISTER_DIG_P1); | |
335 | - _bme280_calib.dig_P2 = readS16_LE(BME280_REGISTER_DIG_P2); | |
336 | - _bme280_calib.dig_P3 = readS16_LE(BME280_REGISTER_DIG_P3); | |
337 | - _bme280_calib.dig_P4 = readS16_LE(BME280_REGISTER_DIG_P4); | |
338 | - _bme280_calib.dig_P5 = readS16_LE(BME280_REGISTER_DIG_P5); | |
339 | - _bme280_calib.dig_P6 = readS16_LE(BME280_REGISTER_DIG_P6); | |
340 | - _bme280_calib.dig_P7 = readS16_LE(BME280_REGISTER_DIG_P7); | |
341 | - _bme280_calib.dig_P8 = readS16_LE(BME280_REGISTER_DIG_P8); | |
342 | - _bme280_calib.dig_P9 = readS16_LE(BME280_REGISTER_DIG_P9); | |
343 | - | |
344 | - _bme280_calib.dig_H1 = read8(BME280_REGISTER_DIG_H1); | |
345 | - _bme280_calib.dig_H2 = readS16_LE(BME280_REGISTER_DIG_H2); | |
346 | - _bme280_calib.dig_H3 = read8(BME280_REGISTER_DIG_H3); | |
347 | - _bme280_calib.dig_H4 = (read8(BME280_REGISTER_DIG_H4) << 4) | (read8(BME280_REGISTER_DIG_H4+1) & 0xF); | |
348 | - _bme280_calib.dig_H5 = (read8(BME280_REGISTER_DIG_H5+1) << 4) | (read8(BME280_REGISTER_DIG_H5) >> 4); | |
349 | - _bme280_calib.dig_H6 = (int8_t)read8(BME280_REGISTER_DIG_H6); | |
350 | -} | |
351 | - | |
352 | -/**************************************************************************/ | |
353 | -/*! | |
354 | - @brief return true if chip is busy reading cal data | |
355 | -*/ | |
356 | -/**************************************************************************/ | |
357 | -bool Adafruit_BME280::isReadingCalibration(void) | |
358 | -{ | |
359 | - uint8_t const rStatus = read8(BME280_REGISTER_STATUS); | |
360 | - | |
361 | - return (rStatus & (1 << 0)) != 0; | |
362 | -} | |
363 | - | |
364 | - | |
365 | -/**************************************************************************/ | |
366 | -/*! | |
367 | - @brief Returns the temperature from the sensor | |
368 | -*/ | |
369 | -/**************************************************************************/ | |
370 | -float Adafruit_BME280::readTemperature(void) | |
371 | -{ | |
372 | - int32_t var1, var2; | |
373 | - | |
374 | - int32_t adc_T = read24(BME280_REGISTER_TEMPDATA); | |
375 | - if (adc_T == 0x800000) // value in case temp measurement was disabled | |
376 | - return NAN; | |
377 | - adc_T >>= 4; | |
378 | - | |
379 | - var1 = ((((adc_T>>3) - ((int32_t)_bme280_calib.dig_T1 <<1))) * | |
380 | - ((int32_t)_bme280_calib.dig_T2)) >> 11; | |
381 | - | |
382 | - var2 = (((((adc_T>>4) - ((int32_t)_bme280_calib.dig_T1)) * | |
383 | - ((adc_T>>4) - ((int32_t)_bme280_calib.dig_T1))) >> 12) * | |
384 | - ((int32_t)_bme280_calib.dig_T3)) >> 14; | |
385 | - | |
386 | - t_fine = var1 + var2; | |
387 | - | |
388 | - float T = (t_fine * 5 + 128) >> 8; | |
389 | - return T/100; | |
390 | -} | |
391 | - | |
392 | - | |
393 | -/**************************************************************************/ | |
394 | -/*! | |
395 | - @brief Returns the temperature from the sensor | |
396 | -*/ | |
397 | -/**************************************************************************/ | |
398 | -float Adafruit_BME280::readPressure(void) { | |
399 | - int64_t var1, var2, p; | |
400 | - | |
401 | - readTemperature(); // must be done first to get t_fine | |
402 | - | |
403 | - int32_t adc_P = read24(BME280_REGISTER_PRESSUREDATA); | |
404 | - if (adc_P == 0x800000) // value in case pressure measurement was disabled | |
405 | - return NAN; | |
406 | - adc_P >>= 4; | |
407 | - | |
408 | - var1 = ((int64_t)t_fine) - 128000; | |
409 | - var2 = var1 * var1 * (int64_t)_bme280_calib.dig_P6; | |
410 | - var2 = var2 + ((var1*(int64_t)_bme280_calib.dig_P5)<<17); | |
411 | - var2 = var2 + (((int64_t)_bme280_calib.dig_P4)<<35); | |
412 | - var1 = ((var1 * var1 * (int64_t)_bme280_calib.dig_P3)>>8) + | |
413 | - ((var1 * (int64_t)_bme280_calib.dig_P2)<<12); | |
414 | - var1 = (((((int64_t)1)<<47)+var1))*((int64_t)_bme280_calib.dig_P1)>>33; | |
415 | - | |
416 | - if (var1 == 0) { | |
417 | - return 0; // avoid exception caused by division by zero | |
418 | - } | |
419 | - p = 1048576 - adc_P; | |
420 | - p = (((p<<31) - var2)*3125) / var1; | |
421 | - var1 = (((int64_t)_bme280_calib.dig_P9) * (p>>13) * (p>>13)) >> 25; | |
422 | - var2 = (((int64_t)_bme280_calib.dig_P8) * p) >> 19; | |
423 | - | |
424 | - p = ((p + var1 + var2) >> 8) + (((int64_t)_bme280_calib.dig_P7)<<4); | |
425 | - return (float)p/256; | |
426 | -} | |
427 | - | |
428 | - | |
429 | -/**************************************************************************/ | |
430 | -/*! | |
431 | - @brief Returns the humidity from the sensor | |
432 | -*/ | |
433 | -/**************************************************************************/ | |
434 | -float Adafruit_BME280::readHumidity(void) { | |
435 | - readTemperature(); // must be done first to get t_fine | |
436 | - | |
437 | - int32_t adc_H = read16(BME280_REGISTER_HUMIDDATA); | |
438 | - if (adc_H == 0x8000) // value in case humidity measurement was disabled | |
439 | - return NAN; | |
440 | - | |
441 | - int32_t v_x1_u32r; | |
442 | - | |
443 | - v_x1_u32r = (t_fine - ((int32_t)76800)); | |
444 | - | |
445 | - v_x1_u32r = (((((adc_H << 14) - (((int32_t)_bme280_calib.dig_H4) << 20) - | |
446 | - (((int32_t)_bme280_calib.dig_H5) * v_x1_u32r)) + ((int32_t)16384)) >> 15) * | |
447 | - (((((((v_x1_u32r * ((int32_t)_bme280_calib.dig_H6)) >> 10) * | |
448 | - (((v_x1_u32r * ((int32_t)_bme280_calib.dig_H3)) >> 11) + ((int32_t)32768))) >> 10) + | |
449 | - ((int32_t)2097152)) * ((int32_t)_bme280_calib.dig_H2) + 8192) >> 14)); | |
450 | - | |
451 | - v_x1_u32r = (v_x1_u32r - (((((v_x1_u32r >> 15) * (v_x1_u32r >> 15)) >> 7) * | |
452 | - ((int32_t)_bme280_calib.dig_H1)) >> 4)); | |
453 | - | |
454 | - v_x1_u32r = (v_x1_u32r < 0) ? 0 : v_x1_u32r; | |
455 | - v_x1_u32r = (v_x1_u32r > 419430400) ? 419430400 : v_x1_u32r; | |
456 | - float h = (v_x1_u32r>>12); | |
457 | - return h / 1024.0; | |
458 | -} | |
459 | - | |
460 | - | |
461 | -/**************************************************************************/ | |
462 | -/*! | |
463 | - Calculates the altitude (in meters) from the specified atmospheric | |
464 | - pressure (in hPa), and sea-level pressure (in hPa). | |
465 | - | |
466 | - @param seaLevel Sea-level pressure in hPa | |
467 | - @param atmospheric Atmospheric pressure in hPa | |
468 | -*/ | |
469 | -/**************************************************************************/ | |
470 | -float Adafruit_BME280::readAltitude(float seaLevel) | |
471 | -{ | |
472 | - // Equation taken from BMP180 datasheet (page 16): | |
473 | - // http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf | |
474 | - | |
475 | - // Note that using the equation from wikipedia can give bad results | |
476 | - // at high altitude. See this thread for more information: | |
477 | - // http://forums.adafruit.com/viewtopic.php?f=22&t=58064 | |
478 | - | |
479 | - float atmospheric = readPressure() / 100.0F; | |
480 | - return 44330.0 * (1.0 - pow(atmospheric / seaLevel, 0.1903)); | |
481 | -} | |
482 | - | |
483 | - | |
484 | -/**************************************************************************/ | |
485 | -/*! | |
486 | - Calculates the pressure at sea level (in hPa) from the specified altitude | |
487 | - (in meters), and atmospheric pressure (in hPa). | |
488 | - @param altitude Altitude in meters | |
489 | - @param atmospheric Atmospheric pressure in hPa | |
490 | -*/ | |
491 | -/**************************************************************************/ | |
492 | -float Adafruit_BME280::seaLevelForAltitude(float altitude, float atmospheric) | |
493 | -{ | |
494 | - // Equation taken from BMP180 datasheet (page 17): | |
495 | - // http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf | |
496 | - | |
497 | - // Note that using the equation from wikipedia can give bad results | |
498 | - // at high altitude. See this thread for more information: | |
499 | - // http://forums.adafruit.com/viewtopic.php?f=22&t=58064 | |
500 | - | |
501 | - return atmospheric / pow(1.0 - (altitude/44330.0), 5.255); | |
502 | -} |
librairie/adafruit/Adafruit_BME280_Library-master/Adafruit_BME280.h deleted
... | ... | @@ -1,295 +0,0 @@ |
1 | -/*************************************************************************** | |
2 | - This is a library for the BME280 humidity, temperature & pressure sensor | |
3 | - | |
4 | - Designed specifically to work with the Adafruit BME280 Breakout | |
5 | - ----> http://www.adafruit.com/products/2650 | |
6 | - | |
7 | - These sensors use I2C or SPI to communicate, 2 or 4 pins are required | |
8 | - to interface. | |
9 | - | |
10 | - Adafruit invests time and resources providing this open source code, | |
11 | - please support Adafruit andopen-source hardware by purchasing products | |
12 | - from Adafruit! | |
13 | - | |
14 | - Written by Limor Fried & Kevin Townsend for Adafruit Industries. | |
15 | - BSD license, all text above must be included in any redistribution | |
16 | - ***************************************************************************/ | |
17 | -#ifndef __BME280_H__ | |
18 | -#define __BME280_H__ | |
19 | - | |
20 | -#if (ARDUINO >= 100) | |
21 | - #include "Arduino.h" | |
22 | -#else | |
23 | - #include "WProgram.h" | |
24 | -#endif | |
25 | - | |
26 | -#include <Adafruit_Sensor.h> | |
27 | -#include <Wire.h> | |
28 | - | |
29 | -/*========================================================================= | |
30 | - I2C ADDRESS/BITS | |
31 | - -----------------------------------------------------------------------*/ | |
32 | - #define BME280_ADDRESS (0x77) | |
33 | -/*=========================================================================*/ | |
34 | - | |
35 | -/*========================================================================= | |
36 | - REGISTERS | |
37 | - -----------------------------------------------------------------------*/ | |
38 | - enum | |
39 | - { | |
40 | - BME280_REGISTER_DIG_T1 = 0x88, | |
41 | - BME280_REGISTER_DIG_T2 = 0x8A, | |
42 | - BME280_REGISTER_DIG_T3 = 0x8C, | |
43 | - | |
44 | - BME280_REGISTER_DIG_P1 = 0x8E, | |
45 | - BME280_REGISTER_DIG_P2 = 0x90, | |
46 | - BME280_REGISTER_DIG_P3 = 0x92, | |
47 | - BME280_REGISTER_DIG_P4 = 0x94, | |
48 | - BME280_REGISTER_DIG_P5 = 0x96, | |
49 | - BME280_REGISTER_DIG_P6 = 0x98, | |
50 | - BME280_REGISTER_DIG_P7 = 0x9A, | |
51 | - BME280_REGISTER_DIG_P8 = 0x9C, | |
52 | - BME280_REGISTER_DIG_P9 = 0x9E, | |
53 | - | |
54 | - BME280_REGISTER_DIG_H1 = 0xA1, | |
55 | - BME280_REGISTER_DIG_H2 = 0xE1, | |
56 | - BME280_REGISTER_DIG_H3 = 0xE3, | |
57 | - BME280_REGISTER_DIG_H4 = 0xE4, | |
58 | - BME280_REGISTER_DIG_H5 = 0xE5, | |
59 | - BME280_REGISTER_DIG_H6 = 0xE7, | |
60 | - | |
61 | - BME280_REGISTER_CHIPID = 0xD0, | |
62 | - BME280_REGISTER_VERSION = 0xD1, | |
63 | - BME280_REGISTER_SOFTRESET = 0xE0, | |
64 | - | |
65 | - BME280_REGISTER_CAL26 = 0xE1, // R calibration stored in 0xE1-0xF0 | |
66 | - | |
67 | - BME280_REGISTER_CONTROLHUMID = 0xF2, | |
68 | - BME280_REGISTER_STATUS = 0XF3, | |
69 | - BME280_REGISTER_CONTROL = 0xF4, | |
70 | - BME280_REGISTER_CONFIG = 0xF5, | |
71 | - BME280_REGISTER_PRESSUREDATA = 0xF7, | |
72 | - BME280_REGISTER_TEMPDATA = 0xFA, | |
73 | - BME280_REGISTER_HUMIDDATA = 0xFD | |
74 | - }; | |
75 | - | |
76 | -/*=========================================================================*/ | |
77 | - | |
78 | -/*========================================================================= | |
79 | - CALIBRATION DATA | |
80 | - -----------------------------------------------------------------------*/ | |
81 | - typedef struct | |
82 | - { | |
83 | - uint16_t dig_T1; | |
84 | - int16_t dig_T2; | |
85 | - int16_t dig_T3; | |
86 | - | |
87 | - uint16_t dig_P1; | |
88 | - int16_t dig_P2; | |
89 | - int16_t dig_P3; | |
90 | - int16_t dig_P4; | |
91 | - int16_t dig_P5; | |
92 | - int16_t dig_P6; | |
93 | - int16_t dig_P7; | |
94 | - int16_t dig_P8; | |
95 | - int16_t dig_P9; | |
96 | - | |
97 | - uint8_t dig_H1; | |
98 | - int16_t dig_H2; | |
99 | - uint8_t dig_H3; | |
100 | - int16_t dig_H4; | |
101 | - int16_t dig_H5; | |
102 | - int8_t dig_H6; | |
103 | - } bme280_calib_data; | |
104 | -/*=========================================================================*/ | |
105 | - | |
106 | -/* | |
107 | -class Adafruit_BME280_Unified : public Adafruit_Sensor | |
108 | -{ | |
109 | - public: | |
110 | - Adafruit_BME280_Unified(int32_t sensorID = -1); | |
111 | - | |
112 | - bool begin(uint8_t addr = BME280_ADDRESS); | |
113 | - void getTemperature(float *temp); | |
114 | - void getPressure(float *pressure); | |
115 | - float pressureToAltitude(float seaLevel, float atmospheric, float temp); | |
116 | - float seaLevelForAltitude(float altitude, float atmospheric, float temp); | |
117 | - void getEvent(sensors_event_t*); | |
118 | - void getSensor(sensor_t*); | |
119 | - | |
120 | - private: | |
121 | - uint8_t _i2c_addr; | |
122 | - int32_t _sensorID; | |
123 | -}; | |
124 | - | |
125 | -*/ | |
126 | - | |
127 | -class Adafruit_BME280 { | |
128 | - public: | |
129 | - enum sensor_sampling { | |
130 | - SAMPLING_NONE = 0b000, | |
131 | - SAMPLING_X1 = 0b001, | |
132 | - SAMPLING_X2 = 0b010, | |
133 | - SAMPLING_X4 = 0b011, | |
134 | - SAMPLING_X8 = 0b100, | |
135 | - SAMPLING_X16 = 0b101 | |
136 | - }; | |
137 | - | |
138 | - enum sensor_mode { | |
139 | - MODE_SLEEP = 0b00, | |
140 | - MODE_FORCED = 0b01, | |
141 | - MODE_NORMAL = 0b11 | |
142 | - }; | |
143 | - | |
144 | - enum sensor_filter { | |
145 | - FILTER_OFF = 0b000, | |
146 | - FILTER_X2 = 0b001, | |
147 | - FILTER_X4 = 0b010, | |
148 | - FILTER_X8 = 0b011, | |
149 | - FILTER_X16 = 0b100 | |
150 | - }; | |
151 | - | |
152 | - // standby durations in ms | |
153 | - enum standby_duration { | |
154 | - STANDBY_MS_0_5 = 0b000, | |
155 | - STANDBY_MS_10 = 0b110, | |
156 | - STANDBY_MS_20 = 0b111, | |
157 | - STANDBY_MS_62_5 = 0b001, | |
158 | - STANDBY_MS_125 = 0b010, | |
159 | - STANDBY_MS_250 = 0b011, | |
160 | - STANDBY_MS_500 = 0b100, | |
161 | - STANDBY_MS_1000 = 0b101 | |
162 | - }; | |
163 | - | |
164 | - // constructors | |
165 | - Adafruit_BME280(void); | |
166 | - Adafruit_BME280(int8_t cspin); | |
167 | - Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); | |
168 | - | |
169 | - bool begin(uint8_t addr = BME280_ADDRESS); | |
170 | - | |
171 | - void setSampling(sensor_mode mode = MODE_NORMAL, | |
172 | - sensor_sampling tempSampling = SAMPLING_X16, | |
173 | - sensor_sampling pressSampling = SAMPLING_X16, | |
174 | - sensor_sampling humSampling = SAMPLING_X16, | |
175 | - sensor_filter filter = FILTER_OFF, | |
176 | - standby_duration duration = STANDBY_MS_0_5 | |
177 | - ); | |
178 | - | |
179 | - void takeForcedMeasurement(); | |
180 | - float readTemperature(void); | |
181 | - float readPressure(void); | |
182 | - float readHumidity(void); | |
183 | - | |
184 | - float readAltitude(float seaLevel); | |
185 | - float seaLevelForAltitude(float altitude, float pressure); | |
186 | - | |
187 | - | |
188 | - private: | |
189 | - void readCoefficients(void); | |
190 | - bool isReadingCalibration(void); | |
191 | - uint8_t spixfer(uint8_t x); | |
192 | - | |
193 | - void write8(byte reg, byte value); | |
194 | - uint8_t read8(byte reg); | |
195 | - uint16_t read16(byte reg); | |
196 | - uint32_t read24(byte reg); | |
197 | - int16_t readS16(byte reg); | |
198 | - uint16_t read16_LE(byte reg); // little endian | |
199 | - int16_t readS16_LE(byte reg); // little endian | |
200 | - | |
201 | - uint8_t _i2caddr; | |
202 | - int32_t _sensorID; | |
203 | - int32_t t_fine; | |
204 | - | |
205 | - int8_t _cs, _mosi, _miso, _sck; | |
206 | - | |
207 | - bme280_calib_data _bme280_calib; | |
208 | - | |
209 | - // The config register | |
210 | - struct config { | |
211 | - // inactive duration (standby time) in normal mode | |
212 | - // 000 = 0.5 ms | |
213 | - // 001 = 62.5 ms | |
214 | - // 010 = 125 ms | |
215 | - // 011 = 250 ms | |
216 | - // 100 = 500 ms | |
217 | - // 101 = 1000 ms | |
218 | - // 110 = 10 ms | |
219 | - // 111 = 20 ms | |
220 | - unsigned int t_sb : 3; | |
221 | - | |
222 | - // filter settings | |
223 | - // 000 = filter off | |
224 | - // 001 = 2x filter | |
225 | - // 010 = 4x filter | |
226 | - // 011 = 8x filter | |
227 | - // 100 and above = 16x filter | |
228 | - unsigned int filter : 3; | |
229 | - | |
230 | - // unused - don't set | |
231 | - unsigned int none : 1; | |
232 | - unsigned int spi3w_en : 1; | |
233 | - | |
234 | - unsigned int get() { | |
235 | - return (t_sb << 5) | (filter << 3) | spi3w_en; | |
236 | - } | |
237 | - }; | |
238 | - config _configReg; | |
239 | - | |
240 | - | |
241 | - // The ctrl_meas register | |
242 | - struct ctrl_meas { | |
243 | - // temperature oversampling | |
244 | - // 000 = skipped | |
245 | - // 001 = x1 | |
246 | - // 010 = x2 | |
247 | - // 011 = x4 | |
248 | - // 100 = x8 | |
249 | - // 101 and above = x16 | |
250 | - unsigned int osrs_t : 3; | |
251 | - | |
252 | - // pressure oversampling | |
253 | - // 000 = skipped | |
254 | - // 001 = x1 | |
255 | - // 010 = x2 | |
256 | - // 011 = x4 | |
257 | - // 100 = x8 | |
258 | - // 101 and above = x16 | |
259 | - unsigned int osrs_p : 3; | |
260 | - | |
261 | - // device mode | |
262 | - // 00 = sleep | |
263 | - // 01 or 10 = forced | |
264 | - // 11 = normal | |
265 | - unsigned int mode : 2; | |
266 | - | |
267 | - unsigned int get() { | |
268 | - return (osrs_t << 5) | (osrs_p << 3) | mode; | |
269 | - } | |
270 | - }; | |
271 | - ctrl_meas _measReg; | |
272 | - | |
273 | - | |
274 | - // The ctrl_hum register | |
275 | - struct ctrl_hum { | |
276 | - // unused - don't set | |
277 | - unsigned int none : 5; | |
278 | - | |
279 | - // pressure oversampling | |
280 | - // 000 = skipped | |
281 | - // 001 = x1 | |
282 | - // 010 = x2 | |
283 | - // 011 = x4 | |
284 | - // 100 = x8 | |
285 | - // 101 and above = x16 | |
286 | - unsigned int osrs_h : 3; | |
287 | - | |
288 | - unsigned int get() { | |
289 | - return (osrs_h); | |
290 | - } | |
291 | - }; | |
292 | - ctrl_hum _humReg; | |
293 | -}; | |
294 | - | |
295 | -#endif |
librairie/adafruit/Adafruit_BME280_Library-master/README.md deleted
... | ... | @@ -1,59 +0,0 @@ |
1 | -This is a library for the Adafruit BME280 Humidity, Barometric Pressure + Temp sensor | |
2 | - | |
3 | -Designed specifically to work with the Adafruit BME280 Breakout | |
4 | - * http://www.adafruit.com/products/2652 | |
5 | - | |
6 | -These sensors use I2C or SPI to communicate, up to 4 pins are required to interface | |
7 | - | |
8 | -Use of this library also requires [Adafruit_Sensor](https://github.com/adafruit/Adafruit_Sensor) | |
9 | -to be installed on your local system. | |
10 | - | |
11 | -Adafruit invests time and resources providing this open source code, | |
12 | -please support Adafruit and open-source hardware by purchasing | |
13 | -products from Adafruit! | |
14 | - | |
15 | -Check out the links above for our tutorials and wiring diagrams | |
16 | - | |
17 | -Written by Limor Fried/Ladyada for Adafruit Industries. | |
18 | -BSD license, all text above must be included in any redistribution | |
19 | - | |
20 | -To download. click the DOWNLOAD ZIP button, rename the uncompressed folder Adafruit_BME280. | |
21 | -Check that the Adafruit_BME280 folder contains Adafruit_BME280.cpp and Adafruit_BME280.h | |
22 | - | |
23 | -Place the Adafruit_BME280 library folder your arduinosketchfolder/libraries/ folder. | |
24 | -You may need to create the libraries subfolder if its your first library. Restart the IDE. | |
25 | - | |
26 | -We also have a great tutorial on Arduino library installation at: | |
27 | -http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use | |
28 | -<!-- START COMPATIBILITY TABLE --> | |
29 | - | |
30 | -## Compatibility | |
31 | - | |
32 | -MCU | Tested Works | Doesn't Work | Not Tested | Notes | |
33 | ------------------- | :----------: | :----------: | :---------: | ----- | |
34 | -Atmega328 @ 16MHz | X | | | | |
35 | -Atmega328 @ 12MHz | X | | | | |
36 | -Atmega32u4 @ 16MHz | X | | | Use SDA/SCL on pins D2 & D3 | |
37 | -Atmega32u4 @ 8MHz | X | | | Use SDA/SCL on pins D2 & D3 | |
38 | -ESP8266 | X | | | I2C: just works, SPI: SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) | |
39 | -ESP32 | X | | | I2C: just works, SPI: SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) | |
40 | -Atmega2560 @ 16MHz | X | | | Use SDA/SCL on pins 20 & 21 | |
41 | -ATSAM3X8E | X | | | Use SDA/SCL on pins 20 & 21 | |
42 | -ATSAM21D | X | | | | |
43 | -ATtiny85 @ 16MHz | | X | | | |
44 | -ATtiny85 @ 8MHz | | X | | | |
45 | -Intel Curie @ 32MHz | | | X | | |
46 | -STM32F2 | | | X | | |
47 | - | |
48 | - * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini | |
49 | - * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V | |
50 | - * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 | |
51 | - * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro | |
52 | - * ESP8266 : Adafruit Huzzah | |
53 | - * ATmega2560 @ 16MHz : Arduino Mega | |
54 | - * ATSAM3X8E : Arduino Due | |
55 | - * ATSAM21D : Arduino Zero, M0 Pro | |
56 | - * ATtiny85 @ 16MHz : Adafruit Trinket 5V | |
57 | - * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V | |
58 | - | |
59 | -<!-- END COMPATIBILITY TABLE --> |
librairie/adafruit/Adafruit_BME280_Library-master/examples/advancedsettings/advancedsettings.ino deleted
... | ... | @@ -1,157 +0,0 @@ |
1 | -/*************************************************************************** | |
2 | - This is a library for the BME280 humidity, temperature & pressure sensor | |
3 | - | |
4 | - Designed specifically to work with the Adafruit BME280 Breakout | |
5 | - ----> http://www.adafruit.com/products/2650 | |
6 | - | |
7 | - These sensors use I2C or SPI to communicate, 2 or 4 pins are required | |
8 | - to interface. The device's I2C address is either 0x76 or 0x77. | |
9 | - | |
10 | - Adafruit invests time and resources providing this open source code, | |
11 | - please support Adafruit andopen-source hardware by purchasing products | |
12 | - from Adafruit! | |
13 | - | |
14 | - Written by Limor Fried & Kevin Townsend for Adafruit Industries. | |
15 | - BSD license, all text above must be included in any redistribution | |
16 | - ***************************************************************************/ | |
17 | - | |
18 | -#include <Wire.h> | |
19 | -#include <SPI.h> | |
20 | -#include <Adafruit_Sensor.h> | |
21 | -#include <Adafruit_BME280.h> | |
22 | - | |
23 | -#define BME_SCK 13 | |
24 | -#define BME_MISO 12 | |
25 | -#define BME_MOSI 11 | |
26 | -#define BME_CS 10 | |
27 | - | |
28 | -#define SEALEVELPRESSURE_HPA (1013.25) | |
29 | - | |
30 | -Adafruit_BME280 bme; // I2C | |
31 | -//Adafruit_BME280 bme(BME_CS); // hardware SPI | |
32 | -//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI | |
33 | - | |
34 | -unsigned long delayTime; | |
35 | - | |
36 | -void setup() { | |
37 | - Serial.begin(9600); | |
38 | - Serial.println(F("BME280 test")); | |
39 | - | |
40 | - if (! bme.begin()) { | |
41 | - Serial.println("Could not find a valid BME280 sensor, check wiring!"); | |
42 | - while (1); | |
43 | - } | |
44 | - | |
45 | - Serial.println("-- Default Test --"); | |
46 | - Serial.println("normal mode, 16x oversampling for all, filter off,"); | |
47 | - Serial.println("0.5ms standby period"); | |
48 | - delayTime = 5000; | |
49 | - | |
50 | - | |
51 | - // For more details on the following scenarious, see chapter | |
52 | - // 3.5 "Recommended modes of operation" in the datasheet | |
53 | - | |
54 | -/* | |
55 | - // weather monitoring | |
56 | - Serial.println("-- Weather Station Scenario --"); | |
57 | - Serial.println("forced mode, 1x temperature / 1x humidity / 1x pressure oversampling,"); | |
58 | - Serial.println("filter off"); | |
59 | - bme.setSampling(Adafruit_BME280::MODE_FORCED, | |
60 | - Adafruit_BME280::SAMPLING_X1, // temperature | |
61 | - Adafruit_BME280::SAMPLING_X1, // pressure | |
62 | - Adafruit_BME280::SAMPLING_X1, // humidity | |
63 | - Adafruit_BME280::FILTER_OFF ); | |
64 | - | |
65 | - // suggested rate is 1/60Hz (1m) | |
66 | - delayTime = 60000; // in milliseconds | |
67 | -*/ | |
68 | - | |
69 | -/* | |
70 | - // humidity sensing | |
71 | - Serial.println("-- Humidity Sensing Scenario --"); | |
72 | - Serial.println("forced mode, 1x temperature / 1x humidity / 0x pressure oversampling"); | |
73 | - Serial.println("= pressure off, filter off"); | |
74 | - bme.setSampling(Adafruit_BME280::MODE_FORCED, | |
75 | - Adafruit_BME280::SAMPLING_X1, // temperature | |
76 | - Adafruit_BME280::SAMPLING_NONE, // pressure | |
77 | - Adafruit_BME280::SAMPLING_X1, // humidity | |
78 | - Adafruit_BME280::FILTER_OFF ); | |
79 | - | |
80 | - // suggested rate is 1Hz (1s) | |
81 | - delayTime = 1000; // in milliseconds | |
82 | -*/ | |
83 | - | |
84 | -/* | |
85 | - // indoor navigation | |
86 | - Serial.println("-- Indoor Navigation Scenario --"); | |
87 | - Serial.println("normal mode, 16x pressure / 2x temperature / 1x humidity oversampling,"); | |
88 | - Serial.println("0.5ms standby period, filter 16x"); | |
89 | - bme.setSampling(Adafruit_BME280::MODE_NORMAL, | |
90 | - Adafruit_BME280::SAMPLING_X2, // temperature | |
91 | - Adafruit_BME280::SAMPLING_X16, // pressure | |
92 | - Adafruit_BME280::SAMPLING_X1, // humidity | |
93 | - Adafruit_BME280::FILTER_X16, | |
94 | - Adafruit_BME280::STANDBY_MS_0_5 ); | |
95 | - | |
96 | - // suggested rate is 25Hz | |
97 | - // 1 + (2 * T_ovs) + (2 * P_ovs + 0.5) + (2 * H_ovs + 0.5) | |
98 | - // T_ovs = 2 | |
99 | - // P_ovs = 16 | |
100 | - // H_ovs = 1 | |
101 | - // = 40ms (25Hz) | |
102 | - // with standby time that should really be 24.16913... Hz | |
103 | - delayTime = 41; | |
104 | - | |
105 | - /* | |
106 | - // gaming | |
107 | - Serial.println("-- Gaming Scenario --"); | |
108 | - Serial.println("normal mode, 4x pressure / 1x temperature / 0x humidity oversampling,"); | |
109 | - Serial.println("= humidity off, 0.5ms standby period, filter 16x"); | |
110 | - bme.setSampling(Adafruit_BME280::MODE_NORMAL, | |
111 | - Adafruit_BME280::SAMPLING_X1, // temperature | |
112 | - Adafruit_BME280::SAMPLING_X4, // pressure | |
113 | - Adafruit_BME280::SAMPLING_NONE, // humidity | |
114 | - Adafruit_BME280::FILTER_X16, | |
115 | - Adafruit_BME280::STANDBY_MS_0_5 ); | |
116 | - | |
117 | - // Suggested rate is 83Hz | |
118 | - // 1 + (2 * T_ovs) + (2 * P_ovs + 0.5) | |
119 | - // T_ovs = 1 | |
120 | - // P_ovs = 4 | |
121 | - // = 11.5ms + 0.5ms standby | |
122 | - delayTime = 12; | |
123 | -*/ | |
124 | - | |
125 | - Serial.println(); | |
126 | -} | |
127 | - | |
128 | - | |
129 | -void loop() { | |
130 | - // Only needed in forced mode! In normal mode, you can remove the next line. | |
131 | - bme.takeForcedMeasurement(); // has no effect in normal mode | |
132 | - | |
133 | - printValues(); | |
134 | - delay(delayTime); | |
135 | -} | |
136 | - | |
137 | - | |
138 | -void printValues() { | |
139 | - Serial.print("Temperature = "); | |
140 | - Serial.print(bme.readTemperature()); | |
141 | - Serial.println(" *C"); | |
142 | - | |
143 | - Serial.print("Pressure = "); | |
144 | - | |
145 | - Serial.print(bme.readPressure() / 100.0F); | |
146 | - Serial.println(" hPa"); | |
147 | - | |
148 | - Serial.print("Approx. Altitude = "); | |
149 | - Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); | |
150 | - Serial.println(" m"); | |
151 | - | |
152 | - Serial.print("Humidity = "); | |
153 | - Serial.print(bme.readHumidity()); | |
154 | - Serial.println(" %"); | |
155 | - | |
156 | - Serial.println(); | |
157 | -} | |
158 | 0 | \ No newline at end of file |
librairie/adafruit/Adafruit_BME280_Library-master/examples/bme280test/bme280test.ino deleted
... | ... | @@ -1,83 +0,0 @@ |
1 | -/*************************************************************************** | |
2 | - This is a library for the BME280 humidity, temperature & pressure sensor | |
3 | - | |
4 | - Designed specifically to work with the Adafruit BME280 Breakout | |
5 | - ----> http://www.adafruit.com/products/2650 | |
6 | - | |
7 | - These sensors use I2C or SPI to communicate, 2 or 4 pins are required | |
8 | - to interface. The device's I2C address is either 0x76 or 0x77. | |
9 | - | |
10 | - Adafruit invests time and resources providing this open source code, | |
11 | - please support Adafruit andopen-source hardware by purchasing products | |
12 | - from Adafruit! | |
13 | - | |
14 | - Written by Limor Fried & Kevin Townsend for Adafruit Industries. | |
15 | - BSD license, all text above must be included in any redistribution | |
16 | - ***************************************************************************/ | |
17 | - | |
18 | -#include <Wire.h> | |
19 | -#include <SPI.h> | |
20 | -#include <Adafruit_Sensor.h> | |
21 | -#include <Adafruit_BME280.h> | |
22 | - | |
23 | -#define BME_SCK 13 | |
24 | -#define BME_MISO 12 | |
25 | -#define BME_MOSI 11 | |
26 | -#define BME_CS 10 | |
27 | - | |
28 | -#define SEALEVELPRESSURE_HPA (1013.25) | |
29 | - | |
30 | -Adafruit_BME280 bme; // I2C | |
31 | -//Adafruit_BME280 bme(BME_CS); // hardware SPI | |
32 | -//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI | |
33 | - | |
34 | -unsigned long delayTime; | |
35 | - | |
36 | -void setup() { | |
37 | - Serial.begin(9600); | |
38 | - Serial.println(F("BME280 test")); | |
39 | - | |
40 | - bool status; | |
41 | - | |
42 | - // default settings | |
43 | - status = bme.begin(); | |
44 | - if (!status) { | |
45 | - Serial.println("Could not find a valid BME280 sensor, check wiring!"); | |
46 | - while (1); | |
47 | - } | |
48 | - | |
49 | - Serial.println("-- Default Test --"); | |
50 | - delayTime = 1000; | |
51 | - | |
52 | - Serial.println(); | |
53 | - | |
54 | - delay(100); // let sensor boot up | |
55 | -} | |
56 | - | |
57 | - | |
58 | -void loop() { | |
59 | - printValues(); | |
60 | - delay(delayTime); | |
61 | -} | |
62 | - | |
63 | - | |
64 | -void printValues() { | |
65 | - Serial.print("Temperature = "); | |
66 | - Serial.print(bme.readTemperature()); | |
67 | - Serial.println(" *C"); | |
68 | - | |
69 | - Serial.print("Pressure = "); | |
70 | - | |
71 | - Serial.print(bme.readPressure() / 100.0F); | |
72 | - Serial.println(" hPa"); | |
73 | - | |
74 | - Serial.print("Approx. Altitude = "); | |
75 | - Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); | |
76 | - Serial.println(" m"); | |
77 | - | |
78 | - Serial.print("Humidity = "); | |
79 | - Serial.print(bme.readHumidity()); | |
80 | - Serial.println(" %"); | |
81 | - | |
82 | - Serial.println(); | |
83 | -} | |
84 | 0 | \ No newline at end of file |
librairie/adafruit/Adafruit_BME280_Library-master/library.properties deleted
... | ... | @@ -1,9 +0,0 @@ |
1 | -name=Adafruit BME280 Library | |
2 | -version=1.0.5 | |
3 | -author=Adafruit | |
4 | -maintainer=Adafruit <info@adafruit.com> | |
5 | -sentence=Arduino library for BME280 sensors. | |
6 | -paragraph=Arduino library for BME280 humidity and pressure sensors. | |
7 | -category=Sensors | |
8 | -url=https://github.com/adafruit/Adafruit_BME280_Library | |
9 | -architectures=* |
librairie/adafruit/Adafruit_Sensor-master/Adafruit_Sensor.h deleted
... | ... | @@ -1,154 +0,0 @@ |
1 | -/* | |
2 | -* Copyright (C) 2008 The Android Open Source Project | |
3 | -* | |
4 | -* Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | -* you may not use this file except in compliance with the License. | |
6 | -* You may obtain a copy of the License at | |
7 | -* | |
8 | -* http://www.apache.org/licenses/LICENSE-2.0 | |
9 | -* | |
10 | -* Unless required by applicable law or agreed to in writing, software< /span> | |
11 | -* distributed under the License is distributed on an "AS IS" BASIS, | |
12 | -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | -* See the License for the specific language governing permissions and | |
14 | -* limitations under the License. | |
15 | -*/ | |
16 | - | |
17 | -/* Update by K. Townsend (Adafruit Industries) for lighter typedefs, and | |
18 | - * extended sensor support to include color, voltage and current */ | |
19 | - | |
20 | -#ifndef _ADAFRUIT_SENSOR_H | |
21 | -#define _ADAFRUIT_SENSOR_H | |
22 | - | |
23 | -#if ARDUINO >= 100 | |
24 | - #include "Arduino.h" | |
25 | - #include "Print.h" | |
26 | -#else | |
27 | - #include "WProgram.h" | |
28 | -#endif | |
29 | - | |
30 | -/* Intentionally modeled after sensors.h in the Android API: | |
31 | - * https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/sensors.h */ | |
32 | - | |
33 | -/* Constants */ | |
34 | -#define SENSORS_GRAVITY_EARTH (9.80665F) /**< Earth's gravity in m/s^2 */ | |
35 | -#define SENSORS_GRAVITY_MOON (1.6F) /**< The moon's gravity in m/s^2 */ | |
36 | -#define SENSORS_GRAVITY_SUN (275.0F) /**< The sun's gravity in m/s^2 */ | |
37 | -#define SENSORS_GRAVITY_STANDARD (SENSORS_GRAVITY_EARTH) | |
38 | -#define SENSORS_MAGFIELD_EARTH_MAX (60.0F) /**< Maximum magnetic field on Earth's surface */ | |
39 | -#define SENSORS_MAGFIELD_EARTH_MIN (30.0F) /**< Minimum magnetic field on Earth's surface */ | |
40 | -#define SENSORS_PRESSURE_SEALEVELHPA (1013.25F) /**< Average sea level pressure is 1013.25 hPa */ | |
41 | -#define SENSORS_DPS_TO_RADS (0.017453293F) /**< Degrees/s to rad/s multiplier */ | |
42 | -#define SENSORS_GAUSS_TO_MICROTESLA (100) /**< Gauss to micro-Tesla multiplier */ | |
43 | - | |
44 | -/** Sensor types */ | |
45 | -typedef enum | |
46 | -{ | |
47 | - SENSOR_TYPE_ACCELEROMETER = (1), /**< Gravity + linear acceleration */ | |
48 | - SENSOR_TYPE_MAGNETIC_FIELD = (2), | |
49 | - SENSOR_TYPE_ORIENTATION = (3), | |
50 | - SENSOR_TYPE_GYROSCOPE = (4), | |
51 | - SENSOR_TYPE_LIGHT = (5), | |
52 | - SENSOR_TYPE_PRESSURE = (6), | |
53 | - SENSOR_TYPE_PROXIMITY = (8), | |
54 | - SENSOR_TYPE_GRAVITY = (9), | |
55 | - SENSOR_TYPE_LINEAR_ACCELERATION = (10), /**< Acceleration not including gravity */ | |
56 | - SENSOR_TYPE_ROTATION_VECTOR = (11), | |
57 | - SENSOR_TYPE_RELATIVE_HUMIDITY = (12), | |
58 | - SENSOR_TYPE_AMBIENT_TEMPERATURE = (13), | |
59 | - SENSOR_TYPE_VOLTAGE = (15), | |
60 | - SENSOR_TYPE_CURRENT = (16), | |
61 | - SENSOR_TYPE_COLOR = (17) | |
62 | -} sensors_type_t; | |
63 | - | |
64 | -/** struct sensors_vec_s is used to return a vector in a common format. */ | |
65 | -typedef struct { | |
66 | - union { | |
67 | - float v[3]; | |
68 | - struct { | |
69 | - float x; | |
70 | - float y; | |
71 | - float z; | |
72 | - }; | |
73 | - /* Orientation sensors */ | |
74 | - struct { | |
75 | - float roll; /**< Rotation around the longitudinal axis (the plane body, 'X axis'). Roll is positive and increasing when moving downward. -90°<=roll<=90° */ | |
76 | - float pitch; /**< Rotation around the lateral axis (the wing span, 'Y axis'). Pitch is positive and increasing when moving upwards. -180°<=pitch<=180°) */ | |
77 | - 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° */ | |
78 | - }; | |
79 | - }; | |
80 | - int8_t status; | |
81 | - uint8_t reserved[3]; | |
82 | -} sensors_vec_t; | |
83 | - | |
84 | -/** struct sensors_color_s is used to return color data in a common format. */ | |
85 | -typedef struct { | |
86 | - union { | |
87 | - float c[3]; | |
88 | - /* RGB color space */ | |
89 | - struct { | |
90 | - float r; /**< Red component */ | |
91 | - float g; /**< Green component */ | |
92 | - float b; /**< Blue component */ | |
93 | - }; | |
94 | - }; | |
95 | - uint32_t rgba; /**< 24-bit RGBA value */ | |
96 | -} sensors_color_t; | |
97 | - | |
98 | -/* Sensor event (36 bytes) */ | |
99 | -/** struct sensor_event_s is used to provide a single sensor event in a common format. */ | |
100 | -typedef struct | |
101 | -{ | |
102 | - int32_t version; /**< must be sizeof(struct sensors_event_t) */ | |
103 | - int32_t sensor_id; /**< unique sensor identifier */ | |
104 | - int32_t type; /**< sensor type */ | |
105 | - int32_t reserved0; /**< reserved */ | |
106 | - int32_t timestamp; /**< time is in milliseconds */ | |
107 | - union | |
108 | - { | |
109 | - float data[4]; | |
110 | - sensors_vec_t acceleration; /**< acceleration values are in meter per second per second (m/s^2) */ | |
111 | - sensors_vec_t magnetic; /**< magnetic vector values are in micro-Tesla (uT) */ | |
112 | - sensors_vec_t orientation; /**< orientation values are in degrees */ | |
113 | - sensors_vec_t gyro; /**< gyroscope values are in rad/s */ | |
114 | - float temperature; /**< temperature is in degrees centigrade (Celsius) */ | |
115 | - float distance; /**< distance in centimeters */ | |
116 | - float light; /**< light in SI lux units */ | |
117 | - float pressure; /**< pressure in hectopascal (hPa) */ | |
118 | - float relative_humidity; /**< relative humidity in percent */ | |
119 | - float current; /**< current in milliamps (mA) */ | |
120 | - float voltage; /**< voltage in volts (V) */ | |
121 | - sensors_color_t color; /**< color in RGB component values */ | |
122 | - }; | |
123 | -} sensors_event_t; | |
124 | - | |
125 | -/* Sensor details (40 bytes) */ | |
126 | -/** struct sensor_s is used to describe basic information about a specific sensor. */ | |
127 | -typedef struct | |
128 | -{ | |
129 | - char name[12]; /**< sensor name */ | |
130 | - int32_t version; /**< version of the hardware + driver */ | |
131 | - int32_t sensor_id; /**< unique sensor identifier */ | |
132 | - int32_t type; /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */ | |
133 | - float max_value; /**< maximum value of this sensor's value in SI units */ | |
134 | - float min_value; /**< minimum value of this sensor's value in SI units */ | |
135 | - float resolution; /**< smallest difference between two values reported by this sensor */ | |
136 | - int32_t min_delay; /**< min delay in microseconds between events. zero = not a constant rate */ | |
137 | -} sensor_t; | |
138 | - | |
139 | -class Adafruit_Sensor { | |
140 | - public: | |
141 | - // Constructor(s) | |
142 | - Adafruit_Sensor() {} | |
143 | - virtual ~Adafruit_Sensor() {} | |
144 | - | |
145 | - // These must be defined by the subclass | |
146 | - virtual void enableAutoRange(bool enabled) {}; | |
147 | - virtual bool getEvent(sensors_event_t*) = 0; | |
148 | - virtual void getSensor(sensor_t*) = 0; | |
149 | - | |
150 | - private: | |
151 | - bool _autoRange; | |
152 | -}; | |
153 | - | |
154 | -#endif |
librairie/adafruit/Adafruit_Sensor-master/README.md deleted
... | ... | @@ -1,221 +0,0 @@ |
1 | -# Adafruit Unified Sensor Driver # | |
2 | - | |
3 | -Many small embedded systems exist to collect data from sensors, analyse the data, and either take an appropriate action or send that sensor data to another system for processing. | |
4 | - | |
5 | -One of the many challenges of embedded systems design is the fact that parts you used today may be out of production tomorrow, or system requirements may change and you may need to choose a different sensor down the road. | |
6 | - | |
7 | -Creating new drivers is a relatively easy task, but integrating them into existing systems is both error prone and time consuming since sensors rarely use the exact same units of measurement. | |
8 | - | |
9 | -By reducing all data to a single **sensors\_event\_t** 'type' and settling on specific, **standardised SI units** for each sensor family the same sensor types return values that are comparable with any other similar sensor. This enables you to switch sensor models with very little impact on the rest of the system, which can help mitigate some of the risks and problems of sensor availability and code reuse. | |
10 | - | |
11 | -The unified sensor abstraction layer is also useful for data-logging and data-transmission since you only have one well-known type to log or transmit over the air or wire. | |
12 | - | |
13 | -## Unified Sensor Drivers ## | |
14 | - | |
15 | -The following drivers are based on the Adafruit Unified Sensor Driver: | |
16 | - | |
17 | -**Accelerometers** | |
18 | - - [Adafruit\_ADXL345](https://github.com/adafruit/Adafruit_ADXL345) | |
19 | - - [Adafruit\_LSM303DLHC](https://github.com/adafruit/Adafruit_LSM303DLHC) | |
20 | - - [Adafruit\_MMA8451\_Library](https://github.com/adafruit/Adafruit_MMA8451_Library) | |
21 | - | |
22 | -**Gyroscope** | |
23 | - - [Adafruit\_L3GD20\_U](https://github.com/adafruit/Adafruit_L3GD20_U) | |
24 | - | |
25 | -**Light** | |
26 | - - [Adafruit\_TSL2561](https://github.com/adafruit/Adafruit_TSL2561) | |
27 | - - [Adafruit\_TSL2591\_Library](https://github.com/adafruit/Adafruit_TSL2591_Library) | |
28 | - | |
29 | -**Magnetometers** | |
30 | - - [Adafruit\_LSM303DLHC](https://github.com/adafruit/Adafruit_LSM303DLHC) | |
31 | - - [Adafruit\_HMC5883\_Unified](https://github.com/adafruit/Adafruit_HMC5883_Unified) | |
32 | - | |
33 | -**Barometric Pressure** | |
34 | - - [Adafruit\_BMP085\_Unified](https://github.com/adafruit/Adafruit_BMP085_Unified) | |
35 | - - [Adafruit\_BMP183\_Unified\_Library](https://github.com/adafruit/Adafruit_BMP183_Unified_Library) | |
36 | - | |
37 | -**Humidity & Temperature** | |
38 | - - [DHT-sensor-library](https://github.com/adafruit/DHT-sensor-library) | |
39 | - | |
40 | -**Orientation** | |
41 | - - [Adafruit_BNO055](https://github.com/adafruit/Adafruit_BNO055) | |
42 | - | |
43 | -## How Does it Work? ## | |
44 | - | |
45 | -Any driver that supports the Adafruit unified sensor abstraction layer will implement the Adafruit\_Sensor base class. There are two main typedefs and one enum defined in Adafruit_Sensor.h that are used to 'abstract' away the sensor details and values: | |
46 | - | |
47 | -**Sensor Types (sensors\_type\_t)** | |
48 | - | |
49 | -These pre-defined sensor types are used to properly handle the two related typedefs below, and allows us determine what types of units the sensor uses, etc. | |
50 | - | |
51 | -``` | |
52 | -/** Sensor types */ | |
53 | -typedef enum | |
54 | -{ | |
55 | - SENSOR_TYPE_ACCELEROMETER = (1), | |
56 | - SENSOR_TYPE_MAGNETIC_FIELD = (2), | |
57 | - SENSOR_TYPE_ORIENTATION = (3), | |
58 | - SENSOR_TYPE_GYROSCOPE = (4), | |
59 | - SENSOR_TYPE_LIGHT = (5), | |
60 | - SENSOR_TYPE_PRESSURE = (6), | |
61 | - SENSOR_TYPE_PROXIMITY = (8), | |
62 | - SENSOR_TYPE_GRAVITY = (9), | |
63 | - SENSOR_TYPE_LINEAR_ACCELERATION = (10), | |
64 | - SENSOR_TYPE_ROTATION_VECTOR = (11), | |
65 | - SENSOR_TYPE_RELATIVE_HUMIDITY = (12), | |
66 | - SENSOR_TYPE_AMBIENT_TEMPERATURE = (13), | |
67 | - SENSOR_TYPE_VOLTAGE = (15), | |
68 | - SENSOR_TYPE_CURRENT = (16), | |
69 | - SENSOR_TYPE_COLOR = (17) | |
70 | -} sensors_type_t; | |
71 | -``` | |
72 | - | |
73 | -**Sensor Details (sensor\_t)** | |
74 | - | |
75 | -This typedef describes the specific capabilities of this sensor, and allows us to know what sensor we are using beneath the abstraction layer. | |
76 | - | |
77 | -``` | |
78 | -/* Sensor details (40 bytes) */ | |
79 | -/** struct sensor_s is used to describe basic information about a specific sensor. */ | |
80 | -typedef struct | |
81 | -{ | |
82 | - char name[12]; | |
83 | - int32_t version; | |
84 | - int32_t sensor_id; | |
85 | - int32_t type; | |
86 | - float max_value; | |
87 | - float min_value; | |
88 | - float resolution; | |
89 | - int32_t min_delay; | |
90 | -} sensor_t; | |
91 | -``` | |
92 | - | |
93 | -The individual fields are intended to be used as follows: | |
94 | - | |
95 | -- **name**: The sensor name or ID, up to a maximum of twelve characters (ex. "MPL115A2") | |
96 | -- **version**: The version of the sensor HW and the driver to allow us to differentiate versions of the board or driver | |
97 | -- **sensor\_id**: A unique sensor identifier that is used to differentiate this specific sensor instance from any others that are present on the system or in the sensor network | |
98 | -- **type**: The sensor type, based on **sensors\_type\_t** in sensors.h | |
99 | -- **max\_value**: The maximum value that this sensor can return (in the appropriate SI unit) | |
100 | -- **min\_value**: The minimum value that this sensor can return (in the appropriate SI unit) | |
101 | -- **resolution**: The smallest difference between two values that this sensor can report (in the appropriate SI unit) | |
102 | -- **min\_delay**: The minimum delay in microseconds between two sensor events, or '0' if there is no constant sensor rate | |
103 | - | |
104 | -**Sensor Data/Events (sensors\_event\_t)** | |
105 | - | |
106 | -This typedef is used to return sensor data from any sensor supported by the abstraction layer, using standard SI units and scales. | |
107 | - | |
108 | -``` | |
109 | -/* Sensor event (36 bytes) */ | |
110 | -/** struct sensor_event_s is used to provide a single sensor event in a common format. */ | |
111 | -typedef struct | |
112 | -{ | |
113 | - int32_t version; | |
114 | - int32_t sensor_id; | |
115 | - int32_t type; | |
116 | - int32_t reserved0; | |
117 | - int32_t timestamp; | |
118 | - union | |
119 | - { | |
120 | - float data[4]; | |
121 | - sensors_vec_t acceleration; | |
122 | - sensors_vec_t magnetic; | |
123 | - sensors_vec_t orientation; | |
124 | - sensors_vec_t gyro; | |
125 | - float temperature; | |
126 | - float distance; | |
127 | - float light; | |
128 | - float pressure; | |
129 | - float relative_humidity; | |
130 | - float current; | |
131 | - float voltage; | |
132 | - sensors_color_t color; | |
133 | - }; | |
134 | -} sensors_event_t; | |
135 | -``` | |
136 | -It includes the following fields: | |
137 | - | |
138 | -- **version**: Contain 'sizeof(sensors\_event\_t)' to identify which version of the API we're using in case this changes in the future | |
139 | -- **sensor\_id**: A unique sensor identifier that is used to differentiate this specific sensor instance from any others that are present on the system or in the sensor network (must match the sensor\_id value in the corresponding sensor\_t enum above!) | |
140 | -- **type**: the sensor type, based on **sensors\_type\_t** in sensors.h | |
141 | -- **timestamp**: time in milliseconds when the sensor value was read | |
142 | -- **data[4]**: An array of four 32-bit values that allows us to encapsulate any type of sensor data via a simple union (further described below) | |
143 | - | |
144 | -**Required Functions** | |
145 | - | |
146 | -In addition to the two standard types and the sensor type enum, all drivers based on Adafruit_Sensor must also implement the following two functions: | |
147 | - | |
148 | -``` | |
149 | -bool getEvent(sensors_event_t*); | |
150 | -``` | |
151 | -Calling this function will populate the supplied sensors\_event\_t reference with the latest available sensor data. You should call this function as often as you want to update your data. | |
152 | - | |
153 | -``` | |
154 | -void getSensor(sensor_t*); | |
155 | -``` | |
156 | -Calling this function will provide some basic information about the sensor (the sensor name, driver version, min and max values, etc. | |
157 | - | |
158 | -**Standardised SI values for sensors\_event\_t** | |
159 | - | |
160 | -A key part of the abstraction layer is the standardisation of values on SI units of a particular scale, which is accomplished via the data[4] union in sensors\_event\_t above. This 16 byte union includes fields for each main sensor type, and uses the following SI units and scales: | |
161 | - | |
162 | -- **acceleration**: values are in **meter per second per second** (m/s^2) | |
163 | -- **magnetic**: values are in **micro-Tesla** (uT) | |
164 | -- **orientation**: values are in **degrees** | |
165 | -- **gyro**: values are in **rad/s** | |
166 | -- **temperature**: values in **degrees centigrade** (Celsius) | |
167 | -- **distance**: values are in **centimeters** | |
168 | -- **light**: values are in **SI lux** units | |
169 | -- **pressure**: values are in **hectopascal** (hPa) | |
170 | -- **relative\_humidity**: values are in **percent** | |
171 | -- **current**: values are in **milliamps** (mA) | |
172 | -- **voltage**: values are in **volts** (V) | |
173 | -- **color**: values are in 0..1.0 RGB channel luminosity and 32-bit RGBA format | |
174 | - | |
175 | -## The Unified Driver Abstraction Layer in Practice ## | |
176 | - | |
177 | -Using the unified sensor abstraction layer is relatively easy once a compliant driver has been created. | |
178 | - | |
179 | -Every compliant sensor can now be read using a single, well-known 'type' (sensors\_event\_t), and there is a standardised way of interrogating a sensor about its specific capabilities (via sensor\_t). | |
180 | - | |
181 | -An example of reading the [TSL2561](https://github.com/adafruit/Adafruit_TSL2561) light sensor can be seen below: | |
182 | - | |
183 | -``` | |
184 | - Adafruit_TSL2561 tsl = Adafruit_TSL2561(TSL2561_ADDR_FLOAT, 12345); | |
185 | - ... | |
186 | - /* Get a new sensor event */ | |
187 | - sensors_event_t event; | |
188 | - tsl.getEvent(&event); | |
189 | - | |
190 | - /* Display the results (light is measured in lux) */ | |
191 | - if (event.light) | |
192 | - { | |
193 | - Serial.print(event.light); Serial.println(" lux"); | |
194 | - } | |
195 | - else | |
196 | - { | |
197 | - /* If event.light = 0 lux the sensor is probably saturated | |
198 | - and no reliable data could be generated! */ | |
199 | - Serial.println("Sensor overload"); | |
200 | - } | |
201 | -``` | |
202 | - | |
203 | -Similarly, we can get the basic technical capabilities of this sensor with the following code: | |
204 | - | |
205 | -``` | |
206 | - sensor_t sensor; | |
207 | - | |
208 | - sensor_t sensor; | |
209 | - tsl.getSensor(&sensor); | |
210 | - | |
211 | - /* Display the sensor details */ | |
212 | - Serial.println("------------------------------------"); | |
213 | - Serial.print ("Sensor: "); Serial.println(sensor.name); | |
214 | - Serial.print ("Driver Ver: "); Serial.println(sensor.version); | |
215 | - Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id); | |
216 | - Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" lux"); | |
217 | - Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" lux"); | |
218 | - Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" lux"); | |
219 | - Serial.println("------------------------------------"); | |
220 | - Serial.println(""); | |
221 | -``` |
librairie/adafruit/Adafruit_Sensor-master/library.properties deleted
... | ... | @@ -1,9 +0,0 @@ |
1 | -name=Adafruit Unified Sensor | |
2 | -version=1.0.2 | |
3 | -author=Adafruit <info@adafruit.com> | |
4 | -maintainer=Adafruit <info@adafruit.com> | |
5 | -sentence=Required for all Adafruit Unified Sensor based libraries. | |
6 | -paragraph=A unified sensor abstraction layer used by many Adafruit sensor libraries. | |
7 | -category=Sensors | |
8 | -url=https://github.com/adafruit/Adafruit_Sensor | |
9 | -architectures=* |