Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit_SGP30_mbed mbed CCS811 mbed-rtos ALPHASENSE Adafruit_ADS1015_ BME680
main.cpp
00001 #include "mbed.h" 00002 #include "CCS811.h" 00003 #include "Alphasense.h" 00004 #include "NovaSDS011.h" 00005 #include "PMS7003.h" 00006 #include "HPMA115S0.h" 00007 #include "BME680.h" 00008 #include "Adafruit_SGP30.h" 00009 #include "Teseo-LIV3F.h" 00010 00011 CCS811 ccs811(D14, D15); 00012 BME680 BME(D14,D15,0); 00013 Adafruit_SGP30 SGP30(D14, D15); 00014 00015 Serial HPMA(A0,A1); 00016 HPMA115S0 HoneyWell(&HPMA); 00017 00018 Serial novaSerial(A4,A5); 00019 NovaSDS011 nova(&novaSerial); 00020 00021 Serial PMS(D3,D5); 00022 PMS7003 TowerPlant(&PMS); 00023 00024 DigitalOut set(D5); 00025 00026 00027 InterruptIn button(USER_BUTTON); 00028 00029 DigitalOut led(LED1); 00030 00031 int ordo[20]={151500,0,1,0,151600,1,0,1,151600,1,1,1,151600,1,0,0,151600,0,0,1}; 00032 00033 int i=0; 00034 int j=0; 00035 00036 double delay = 0.5; // 500 ms 00037 uint16_t eco2, tvoc; 00038 00039 void pressed() 00040 { 00041 uint8_t trame[100]; 00042 uint8_t oct=0,oct2=0; 00043 i++; 00044 oct2 = ordo[i] << 2; 00045 oct |= oct2; 00046 oct2 = ordo[i+1] << 1; 00047 oct |= oct2; 00048 oct2 = ordo[i+2]; 00049 oct |= oct2; 00050 trame[j]=oct; 00051 j++; 00052 printf("flag ok\r\n"); 00053 printf("\n!!! ALARM 1 Triggered !!!\r\n"); 00054 if(ordo[i]==1){ 00055 printf("Capteur 0 actif - Erreur \r\n"); 00056 trame[j]=1; 00057 j++; 00058 } 00059 if(ordo[i]==1){ 00060 printf("Capteur 1 actif - Heure\r\n"); 00061 trame[j]=2; 00062 j++; 00063 } 00064 i++; 00065 if(ordo[i]==1){ 00066 printf("Capteur 2 actif - N/A \r\n"); 00067 trame[j]=12; 00068 j++; 00069 } 00070 i++; 00071 if(ordo[i]==1){ 00072 printf("Capteur 4 actif - N/A\r\n"); 00073 trame[j]=42; 00074 j++; 00075 } 00076 i++; 00077 if(ordo[i]==1){ 00078 printf("Capteur 5 actif - GNSS \r\n"); 00079 trame[j]=42; 00080 j++; 00081 } 00082 i++; 00083 if(ordo[i]==1){ 00084 printf("Capteur 6 actif - O3\r\n"); /* Alphasense */ 00085 trame[j]=42; 00086 j++; 00087 } 00088 i++; 00089 if(ordo[i]==1){ 00090 printf("Capteur 7 actif - NO2\r\n"); /* Alphasense */ 00091 trame[j]=42; 00092 j++; 00093 } 00094 i++; 00095 if(ordo[i]==1){ 00096 printf("Capteur 8 actif - CO2\r\n"); /* Rechercher */ 00097 trame[j]=42; 00098 j++; 00099 } 00100 i++; 00101 if(ordo[i]==1){ 00102 printf("Capteur 9 actif - eCO2 / VOC \r\n"); /* BME690, CCS811, SGP30 */ 00103 trame[j]=42; 00104 j++; 00105 } 00106 i++; 00107 if(ordo[i]==1){ 00108 printf("Capteur 10 actif - PM2.5 / PM10 \r\n"); /* plantower, omron, sds */ 00109 trame[j]=42; 00110 j++; 00111 } 00112 i++; 00113 if(ordo[i]==1){ 00114 printf("Capteur 11 actif - Pression \r\n"); 00115 trame[j]=42; 00116 j++; 00117 } 00118 i++; 00119 if(ordo[i]==1){ 00120 printf("Capteur 12 actif - Humidite\r\n"); 00121 trame[j]=42; 00122 j++; 00123 } 00124 i++; 00125 if(ordo[i]==1){ 00126 printf("Capteur 13 actif - Temperature\r\n"); /* LM35 */ 00127 trame[j]=42; 00128 j++; 00129 } 00130 printf("Taille = %d La trame = \r\n",j); 00131 for(uint8_t t=0;t<j;t++){ 00132 printf("%d \r\n",trame[t]); 00133 } 00134 j=0; 00135 } 00136 00137 int main() 00138 { 00139 ccs811.init(); 00140 // Assign functions to button 00141 button.fall(&pressed); 00142 00143 while (1) { 00144 led = !led; 00145 } 00146 }
Generated on Wed Jul 13 2022 01:47:14 by
1.7.2