本文整理汇总了C++中DallasTemperature::setWaitForConversion方法的典型用法代码示例。如果您正苦于以下问题:C++ DallasTemperature::setWaitForConversion方法的具体用法?C++ DallasTemperature::setWaitForConversion怎么用?C++ DallasTemperature::setWaitForConversion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DallasTemperature
的用法示例。
在下文中一共展示了DallasTemperature::setWaitForConversion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup() {
// Init display
mySerial.begin(9600); // set up serial port for 9600 baud
delay(500); // wait for display to boot up
// Setup DS1820 temp sensor
sensors.begin();
sensors.setResolution(Sensor1, 11);
sensors.setResolution(Sensor2, 11);
sensors.setWaitForConversion(false);
sensors.requestTemperatures();
delayInMillis = 750 / (1 << (12 - 11)); //750 for 12bit, 400 for 11bit, 220 for 10bit, 100 for 9bit
// calc by delayInMillis = 750 / (1 << (12 - resolution));
lastTempRequest = millis();
// Set next state i FSM
menu_FSM = M_PAGE1;
menu_last_state = M_PAGE1;
system_FSM = S_IDLE;
// **************** Set up display *******************
DisplayClear();
MenuShowTime = millis();
// **************** Set up RTC ***********************
Wire.begin();
rtc.begin();
//TimeDate(rtc.now(),dateTimeString,1);
//DateTime now = rtc.now();
// write on display
DisplayGoto(2,0);
mySerial.print("Version 0.9B");
// **************** Set up SD card *******************
pinMode(10, OUTPUT);
DisplayGoto(1,0);
mySerial.write("Init SD -> "); // clear display + legends
DisplayGoto(1,11);
// see if the card is present and can be initialized:
if (!SD.begin())
mySerial.write("Fail");
else
mySerial.write("OK");
delay(2000);
// ***************** Clear display ********************
DisplayClear();
}
示例2: setup
/**
* @brief arduino setup function
*/
void setup() {
Serial.begin(9600);
Display::Init();
if (RTC.get() == 0) {
// following line sets the RTC to the date & time this sketch was compiled
RTC.set(hhmmss());
}
setSyncProvider(RTC.get); // the function to get the time from the RTC
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(7);
dallastemp.begin(); // Inizialisieren der Dallas Temperature library
dallastemp.setWaitForConversion(false);
aqua.begin();
pinMode(BUTTON_PIN_1, INPUT_PULLUP);
pinMode(BUTTON_PIN_2, INPUT_PULLUP);
// pinMode(BUTTON_PIN_3, INPUT_PULLUP);
// pinMode(BUTTON_PIN_4, INPUT_PULLUP);
}
示例3: setup
void setup()
{
pinMode(13, OUTPUT);
// Set up all of the Digital IO pins.
pinMode(pin_leftCutterCheck,INPUT);
pinMode(pin_rightCutterCheck,INPUT);
pinMode(pin_leftCutterControl,OUTPUT);
pinMode(pin_rightCutterControl,OUTPUT);
// Turn off the cutters by default
digitalWrite(pin_leftCutterControl,LOW);
digitalWrite(pin_rightCutterControl,LOW);
// Initialize the rear panel LED outputs
pinMode(pin_ledHigh,OUTPUT);
pinMode(pin_ledMid,OUTPUT);
pinMode(pin_ledLow,OUTPUT);
digitalWrite(pin_ledHigh, LOW);
digitalWrite(pin_ledMid, LOW);
digitalWrite(pin_ledLow, LOW);
temperatureTop.begin();
temperatureBot.begin();
// Make sure we have temperature sensors, if not, set to something
// unreasonable. This would be 0 in Alabama.
if(!temperatureTop.getAddress(topAddress,0))
{
msgStatus.temperature_1 = 0.0;
} else {
temperatureTop.setResolution(topAddress,9);
temperatureTop.setWaitForConversion(false);
temperatureTop.requestTemperatures();
}
if(!temperatureBot.getAddress(botAddress,0))
{
msgStatus.temperature_2 = 0.0;
} else {
temperatureBot.setResolution(botAddress,9);
temperatureBot.setWaitForConversion(false);
temperatureBot.requestTemperatures();
}
nh.initNode();
nh.advertise(status_pub);
nh.advertiseService(cutter_srv);
}
示例4: setup
void setup()
{
fsmState = EDIT_TIME_MODE;
// initialize thermometer
sensor.begin();
sensor.setWaitForConversion(true);
sensor.getAddress(devAddr, 0);
sensor.requestTemperatures();
tempInCelsius = (int) (sensor.getTempC(devAddr)*10);
// initialize buttons
buttonA.setClickTicks(250);
buttonA.setPressTicks(600);
buttonA.attachLongPressStart(longPressA);
buttonA.attachClick(singleClickA);
buttonA.attachDoubleClick(doubleClickA);
buttonB.setClickTicks(250);
buttonB.setPressTicks(600);
buttonB.attachClick(singleClickB);
buttonB.attachDoubleClick(doubleClickB);
buttonB.attachLongPressStart(longPressB);
// initialize serial
Serial.begin(115200);
// initialize rtc
setSyncProvider(RTC.get);
setSyncInterval(1);
if(timeStatus()!= timeSet)
{
Serial.println("Unable to sync with the RTC");
fsmState = ERROR_MODE;
} else
{
Serial.println("RTC has set the system time");
}
// default alarm settings, 08:30, disabled
pinMode(ALARM_PIN, INPUT_PULLUP);
}
示例5: 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
//.........这里部分代码省略.........