Untitled
unknown
plain_text
7 months ago
1.2 kB
5
Indexable
Never
#include <Wire.h> #include <SFE_BMP180.h> #define TCAADDR 0x70 void tcaselect(uint8_t i) { if (i > 7) return; Wire.beginTransmission(TCAADDR); Wire.write(1 << i); Wire.endTransmission(); } const int sensorcount=6; // number of sensor SFE_BMP180 pressure[sensorcount]; void setup() { Serial.begin(9600); Wire.begin(); Serial.println("Starting Initialization"); for (byte tca = 0; tca <= sensorcount; tca++) { tcaselect(tca); //Serial.println(tca); pressure[tca].begin(); } Serial.println("Initialization Finished"); } void loop() { char status; char count; for (byte tca = 0; tca < sensorcount; tca++) { tcaselect(tca); double T,P; if (count < 6) { status = pressure[tca].startTemperature(); delay(3); status = pressure[tca].getTemperature(T); } status = pressure[tca].startPressure(0); delay(3); status = pressure[tca].getPressure(P,T); Serial.print(millis()); Serial.print(", "); Serial.print(tca); Serial.print(", "); Serial.print(T,2); Serial.print(", "); Serial.println(P,2); if (count > 40) { count = 0; } else count++; } };
Leave a Comment