本文整理汇总了C++中DallasTemperature::requestTemperaturesByAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ DallasTemperature::requestTemperaturesByAddress方法的具体用法?C++ DallasTemperature::requestTemperaturesByAddress怎么用?C++ DallasTemperature::requestTemperaturesByAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DallasTemperature
的用法示例。
在下文中一共展示了DallasTemperature::requestTemperaturesByAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loop
/*
* Main Loop
*/
void loop() {
wdt_reset();
mD.vals.uslCount++; //Increment main datarecord count
AccelerometerScaled Ascaled = accel.ReadScaledAxis(); //Get Scaled Accelerometer
AccelerometerRaw Araw = accel.ReadRawAxis(); //Get Raw Accelerometer
MagnetometerScaled Mscaled = compass.ReadScaledAxis(); //Get Scaled Magnetometer
MagnetometerRaw Mraw = compass.ReadRawAxis(); //Get Raw Magnetometer
LGgyro.read(); //Get Gyro
// offset compass by hard iron
Mraw.XAxis += 40;
Mraw.YAxis += 261;
Mraw.ZAxis += 54;
//write Acc, Mag, & Gyro values to record
float AxisGs = Ascaled.XAxis;
mD.vals.AcXPayload = AxisGs * 100;
AxisGs = Ascaled.YAxis;
mD.vals.AcYPayload = AxisGs * 100;
AxisGs = Ascaled.ZAxis;
mD.vals.AcZPayload = AxisGs * 100;
mD.vals.MgXPayload = Mscaled.XAxis;
mD.vals.MgYPayload = Mscaled.YAxis;
mD.vals.MgZPayload = Mscaled.ZAxis;
mD.vals.GyXPayload = LGgyro.g.x;
mD.vals.GyYPayload = LGgyro.g.y;
mD.vals.GyZPayload = LGgyro.g.z;
//Perform tilt compensation calculation save to record
sixDOF.compCompass(Mraw.XAxis, -Mraw.YAxis, -Mraw.ZAxis, Araw.XAxis, Araw.YAxis, Araw.ZAxis, true);
float compHeading = sixDOF.atan2Int(sixDOF.xAxisComp(), sixDOF.yAxisComp());
compHeading = compHeading /100;
if (compHeading < 0 ) {
compHeading = abs(compHeading);
} else {
compHeading = 180 - compHeading + 180;
}
mD.vals.CmpssPayload = compHeading;
//get BMP085 values save to record
dps.getTemperature(&TmpPayloadFULL);
dps.getPressure(&mD.vals.PressurePayload);
mD.vals.TmpPayload = (int16_t)(TmpPayloadFULL);
mD.vals.TmpExternal = (int16_t)(sensors.getTempC(outsideThermometer)* 10);
sensors.requestTemperaturesByAddress(outsideThermometer); // Send the command to get temperatures
//get GPS data
byte lcount = 0; //reset a loop counter
while (!NEWGPSDATA && lcount++ < 255) { //Exit the loop if we have new data or have been round it a number of times
NEWGPSDATA = feedgps();
}
if (NEWGPSDATA) { //We have new GPS data, get all of the fields we need.
int tmp_year = 0;
gps.crack_datetime(&tmp_year, &mD.vals.month, &mD.vals.day,&mD.vals.hour, &mD.vals.minute, &mD.vals.second, &mD.vals.hundredths, &mD.vals.age);
mD.vals.year = tmp_year - 2000;
if (gps.altitude() != TinyGPS_HJOE::GPS_INVALID_ALTITUDE && gps.altitude() >= 0) {
gps.get_position(&mD.vals.iLat, &mD.vals.iLong, &mD.vals.age);
mD.vals.iAlt = gps.altitude();
mD.vals.iAngle = gps.course();
mD.vals.iHspeed = gps.speed();
mD.vals.bSats = gps.satellites();
mD.vals.ihdop = gps.hdop();
}
SET_LED_Status(SET_LED_BLUE,0); //Flash blue to show we are getting GPS data
} else {
SET_LED_Status(SET_LED_GREEN,0); //Flash Green to show that we are looping but not getting GPS data
}
if(ETSerialIn.receiveData()){
}
//flip flop between I2C's to avoid both on one loop
if (SENDWIRE && (millis() - elapseSIM900) > WAIT_SIM900) {
mD.vals.tCount++;
ETI2Cout.sendData(I2C_SLV_SIM900_ADDRESS);
elapseSIM900 = millis();
}
if (!SENDWIRE && (millis() - elapseNTXB) > WAIT_NTXB) {
mD.vals.tCount++;
ETI2Cout.sendData(I2C_SLV_NTXB_ADDRESS);
elapseNTXB = millis();
//get I2C_SLV_SIM900_ADDRESS data
}
writeSDData(); //Write the data record to the SD card
SET_LED_Status(SET_LED_OFF,0); //turn off the LED
NEWGPSDATA = false; //Reset the New GPS Data flag
SENDWIRE = !SENDWIRE; //Flipflop this
}
示例2: setup
/*
* Setup
*/
void setup() {
wdt_enable(WDTO_8S);
wdt_reset();
//Setup Ports
Serial.begin(115200); //Start Debug Serial 0
Serial1.begin(9600); //Start GPS Serial 1
Serial2.begin(9600);
pinMode(PIN_LED_GREEN, OUTPUT); //Blue GREEN
pinMode(PIN_LED_RED, OUTPUT); //Blue RED
pinMode(PIN_LED_BLUE, OUTPUT); //Blue LED
pinMode(PIN_SPI_CS,OUTPUT); //Chip Select Pin for the SD Card
pinMode(10, OUTPUT); //SDcard library expect 10 to set set as output.
// Initialise the GPS
wdt_disable();
gps.init();
gps.configureUbloxSettings(); // Configure Ublox for MY_HIGH altitude mode
wdt_enable(WDTO_8S);
// join I2C bus //start I2C transfer to the Module/Transmitter
Wire.begin();
//Set up the two EasyTransfer methods
ETI2Cout.begin(details(mD.i2cOut), &Wire); //setup the data structure to transfer out
ETSerialIn.begin(details(vals), &Serial2);
//Start up the LGgyro
if (LGgyro.init()) {
#ifdef DEBUG_ON
Serial.println("LGgyro OK");
#endif
LGgyro.enableDefault();
} else {
#ifdef DEBUG_ON
Serial.println("LGgyro not working");
#endif
SET_LED_Status(SET_LED_WHITE,500); //White LED
SET_LED_Status(SET_LED_RED,1000); //Red LED
}
//Start up the accelerometer
accel = ADXL345(); // Create an instance of the accelerometer
if(accel.EnsureConnected()) { // Check that the accelerometer is connected.
#ifdef DEBUG_ON
Serial.println("Connected to ADXL345.");
#endif
accel.SetRange(2, true); // Set the range of the accelerometer to a maximum of 2G.
accel.EnableMeasurements(); // Tell the accelerometer to start taking measurements.
} else{
#ifdef DEBUG_ON
Serial.println("Could not connect to ADXL345.");
#endif
SET_LED_Status(SET_LED_WHITE,500); //White LED
SET_LED_Status(SET_LED_RED,2000); //Red LED
}
//Start up the compass
compass = HMC5883L(); // Construct a new HMC5883 compass.
#ifdef DEBUG_ON
if(compass.EnsureConnected() == 1) {
Serial.println("Connected to HMC5883L.");
} else {
Serial.println("Not Connected to HMC5883L.");
}
#endif
error = compass.SetScale(1.3); // Set the scale of the compass.
#ifdef DEBUG_ON
if(error != 0) { // If there is an error, print it out.
Serial.println("Compass Error 1");
Serial.println(compass.GetErrorText(error));
} else {
Serial.println("Compass Ok 1");
}
#endif
error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous
#ifdef DEBUG_ON
if(error != 0) { // If there is an error, print it out.
Serial.println("Compass error 2");
Serial.println(compass.GetErrorText(error));
} else {
Serial.println("Compass Ok 2");
}
#endif
//Start up the Pressure Sensor
dps = BMP085();
dps.init();
#ifdef DEBUG_ON
Serial.print("BMP Mode ");
Serial.println(dps.getMode());
#endif
wdt_reset();
// Start up the OneWire Sensors library and turn off blocking takes too long!
sensors.begin();
sensors.setWaitForConversion(false);
sensors.requestTemperaturesByAddress(outsideThermometer); // Send the command to get temperature
//Initialise all of the record values
//.........这里部分代码省略.........