当前位置: 首页>>代码示例>>C++>>正文


C++ DallasTemperature::begin方法代码示例

本文整理汇总了C++中DallasTemperature::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DallasTemperature::begin方法的具体用法?C++ DallasTemperature::begin怎么用?C++ DallasTemperature::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DallasTemperature的用法示例。


在下文中一共展示了DallasTemperature::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

void setup() {
  //Serial.begin(9600);

  PgmPrint("Free RAM: ");
  //Serial.println(FreeRam());  

  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  pinMode(10, OUTPUT);                       // set the SS pin as an output (necessary!)
  digitalWrite(10, HIGH);                    // but turn off the W5100 chip!

  if (!card.init(SPI_HALF_SPEED, 4)) error("card.init failed!");

  // initialize a FAT volume
  if (!volume.init(&card)) error("vol.init failed!");

  PgmPrint("Volume is FAT");
  //Serial.println(volume.fatType(),DEC);
  //Serial.println();

  if (!root.openRoot(&volume)) error("openRoot failed");

  // list file in root with date and size
  PgmPrintln("Files found in root:");
  root.ls(LS_DATE | LS_SIZE);
  //Serial.println();

  // Recursive list of all directories
  PgmPrintln("Files found in all dirs:");
  root.ls(LS_R);

  //Serial.println();
  PgmPrintln("Done");

  // Debugging complete, we start the server!
  Ethernet.begin(mac, ip);
  server.begin();
  
  // Start up the temperature library
  sensorsa.begin();
  sensorsb.begin();
  sensorsc.begin();
  sensorsd.begin();
  
  setTime(0); // start the clock
  time33mins = time60mins = now();

}
开发者ID:edboel,项目名称:projects,代码行数:48,代码来源:logtemps.c

示例2: sensor_setup

void sensor_setup(){  
  temp_sensor.begin();//initialize one wire sensor
  temp_sensor.setResolution(insideThermometer, 9);  //configure sensor parameters 
  
   
#ifdef DEBUG_SENS
  // report on finding the devices on the bus or not
  if (!temp_sensor.getAddress(insideThermometer, 0)) softdebug.println("Unable to find address for Device 0");
  else{  
    
    // report parasite power requirements
    softdebug.print("Parasite power is: "); 
    if (temp_sensor.isParasitePowerMode()) softdebug.println("ON");
    else softdebug.println("OFF");
    
    sensors_temperature(); //print temperature for debugging
    
  }
  
  //print voltage sensor value for debugging
  softdebug.print("Vin=");
  softdebug.println(sensors_vin());
  
#endif //DEBUG_SENS
}
开发者ID:Balua,项目名称:Balua_AIO_Tracker_V1_0_Code,代码行数:25,代码来源:sensors_avr.cpp

示例3:

float MXS1101::getTempC()
{
	oneWire.reset();
	_MXS1101.begin();
	_MXS1101.requestTemperatures();
	return _MXS1101.getTempCByIndex(0);
}
开发者ID:ckt1010,项目名称:ArduinoLib-SMeshlink,代码行数:7,代码来源:MXS1101.cpp

示例4: 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);
}
开发者ID:djtulan,项目名称:Arduino-Aquarium,代码行数:28,代码来源:aquarium.cpp

示例5: 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();
   
  }
开发者ID:lvesterg,项目名称:heater,代码行数:60,代码来源:heater_FSM.c

示例6: 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);
}
开发者ID:Auburn-Automow,项目名称:au_automow_drivers,代码行数:46,代码来源:power_control.cpp

示例7: initSensors

//Sensor initializing functions:
void OpenGardenClass::initSensors(void){
  pinMode(sensorPowerPin, OUTPUT);
  pinMode(ecPowerPin, OUTPUT);
  digitalWrite(sensorPowerPin, LOW); 
  digitalWrite(ecPowerPin, LOW);
  sensors.begin();
  dht.begin();
}
开发者ID:thaussma,项目名称:OpenGarden,代码行数:9,代码来源:OpenGarden.cpp

示例8: begin

void Thermometer::begin() {
   if (!initialized) {
      // Start up the library
      sensors.begin();
      sensors.setResolution(thermometerAddress, RESOLUTION);

      initialized = true;
   }
}
开发者ID:slobrewer,项目名称:FermbotPrototype,代码行数:9,代码来源:Thermometer.cpp

示例9: oneWire

double Sensor::getDS18B20Reading()
{
    OneWire oneWire(index);
    DallasTemperature sensor = DallasTemperature(&oneWire);
    sensor.setResolution(12);
    sensor.begin();
    sensor.requestTemperatures();
    return sensor.getTempCByIndex(0);
}
开发者ID:Urokhtor,项目名称:Naga-Automation-Suite,代码行数:9,代码来源:Sensor.cpp

示例10: setup

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // locate devices on the bus
  Serial.print("Locating devices...");
  sensors.begin();
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");

  // report parasite power requirements
  Serial.print("Parasite power is: "); 
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");
  
  // assign address manually.  the addresses below will beed to be changed
  // to valid device addresses on your bus.  device address can be retrieved
  // by using either oneWire.search(deviceAddress) or individually via
  // sensors.getAddress(deviceAddress, index)
  //insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };

  // Method 1:
  // search for devices on the bus and assign based on an index.  ideally,
  // you would do this to initially discover addresses on the bus and then 
  // use those addresses and manually assign them (see above) once you know 
  // the devices on your bus (and assuming they don't change).
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); 
  
  // method 2: search()
  // search() looks for the next device. Returns 1 if a new address has been
  // returned. A zero might mean that the bus is shorted, there are no devices, 
  // or you have already retrieved all of them.  It might be a good idea to 
  // check the CRC to make sure you didn't get garbage.  The order is 
  // deterministic. You will always get the same devices in the same order
  //
  // Must be called before search()
  //oneWire.reset_search();
  // assigns the first address found to insideThermometer
  //if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer");

  // show the addresses we found on the bus
  Serial.print("Device 0 Address: ");
  printAddress(insideThermometer);
  Serial.println();

  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(insideThermometer, 9);
 
  Serial.print("Device 0 Resolution: ");
  Serial.print(sensors.getResolution(insideThermometer), DEC); 
  Serial.println();

  
}
开发者ID:justinatomatic,项目名称:DallasTemperature_SparkCore,代码行数:57,代码来源:application.cpp

示例11:

 void DS18B20_init(){
     #ifdef DEBUG_DS18B20_POLLER
         DEBUG_1("Starting");
     #endif
     ds_sensors.begin();
     ds_count = ds_sensors.getDeviceCount();
     #ifdef DEBUG_DS18B20_POLLER
         DEBUG_1("Finished");
     #endif
 }
开发者ID:Tambralinga,项目名称:loguino,代码行数:10,代码来源:code.c

示例12: setup

void setup(void)
{
  // start serial port
  Serial.begin(38400);
  delay(1000);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
  
  // Grab a count of devices on the wire
  numberOfDevices = sensors.getDeviceCount();
  
  // locate devices on the bus
  Serial.print("Locating devices...");
  
  Serial.print("Found ");
  Serial.print(numberOfDevices, DEC);
  Serial.println(" devices.");

  // report parasite power requirements
  Serial.print("Parasite power is: "); 
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");
  
  // Loop through each device, print out address
  for(int i=0;i<numberOfDevices; i++)
  {
    // Search the wire for address
    if(sensors.getAddress(tempDeviceAddress, i))
	{
		Serial.print("Found device ");
		Serial.print(i, DEC);
		Serial.print(" with address: ");
		printAddress(tempDeviceAddress);
		Serial.println();
		
		Serial.print("Setting resolution to ");
		Serial.println(TEMPERATURE_PRECISION, DEC);
		
		// set the resolution to TEMPERATURE_PRECISION bit (Each Dallas/Maxim device is capable of several different resolutions)
		sensors.setResolution(tempDeviceAddress, TEMPERATURE_PRECISION);
		
		 Serial.print("Resolution actually set to: ");
		Serial.print(sensors.getResolution(tempDeviceAddress), DEC); 
		Serial.println();
	}else{
		Serial.print("Found ghost device at ");
		Serial.print(i, DEC);
		Serial.print(" but could not detect address. Check power and cabling");
	}
  }

}
开发者ID:hdo,项目名称:arduino_panstamp,代码行数:54,代码来源:Tester.cpp

示例13: setup

void setup() {
    delay(2000);

    Serial.begin(9600);

    Serial.print("Setup...");

    sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
    inside_thermometer.setResolution(10);
    cabinet_thermometer.setResolution(10);
    outside_thermometer.setResolution(10);

    I2c.begin();
    I2c.timeOut(100);
    I2c.write(SERVO_CONTROLLER_ADDRESS, SERVO_CONFIG_REGISTER, SERVO_STANDARD_MODE);
    analogReference(EXTERNAL);

    fan_a.begin(ConfigureMax6651(i2c_master, ADDRESS_VCC)
                                .v12()
                                .preScaler(PRESCALER_DIVIDE_BY_2)
                                .tachometerCountTime(TACH_COUNT_TIME_2_0)
                                .tachometerAlarm(true)
                                .minAlarm(true)
                                .maxAlarm(true)
                                .gpio0AsAlertOutput()
                                .gpioAsOutput(1, true)
                                .gpio2AsClockOutput()
                                .gpioAsOutput(3, true)
                                .gpioAsOutput(4, true)
                                .logger(&Serial));

    fan_b.begin(ConfigureMax6651(i2c_master, ADDRESS_GND)
                                .v12()
                                .preScaler(PRESCALER_DIVIDE_BY_2)
                                .tachometerCountTime(TACH_COUNT_TIME_2_0)
                                .tachometerAlarm(true)
                                .minAlarm(true)
                                .maxAlarm(true)
                                .gpio0AsAlertOutput()
                                .gpioAsOutput(1, true)
                                .gpio2AsClockInput()
                                .gpioAsOutput(3, true)
                                .gpioAsOutput(4, true)
                                .logger(&Serial));

   //fan_a.stop();
   //fan_b.stop();

   // TODO: Fan and iris calibration

   controller.begin();

   Serial.println("done.");
}
开发者ID:rob-smallshire,项目名称:mistral-slave,代码行数:54,代码来源:main.cpp

示例14: setup

void setup()
{
   // Note: Ethernet shield uses digitial IO pins 10,11,12, and 13   
   Serial.begin(9600);
  
   Serial.println(version);
   Serial.println();
  
   // locate devices on the 1Wire bus
   Serial.print("Locating devices on 1Wire bus...");
   sensors.begin();
   int count = sensors.getDeviceCount();
   Serial.print("Found ");
   Serial.print( count );
   Serial.println(" devices on 1wire bus");

   // select the first sensor   
   for ( int i=0; i<count; i++ )
   {
      if ( sensors.getAddress(thermometer, i) ) 
      {
         Serial.print("1wire device ");
         Serial.print(i);
         Serial.print(" has address: ");
         printAddress(thermometer);
         Serial.println();
      }
      else
      {
         Serial.print("Unable to find address for 1wire device "); 
         Serial.println( i );
      }  
   }
  
   // if you want to use a particular sensor, you can hard code it here 
   if (0)
   { 
      DeviceAddress addr = { 0x10, 0xE4, 0xF1, 0xD2, 0x01, 0x08, 0x00, 0xBE };
      for (uint8_t i = 0; i < 8; i++)
      {
         thermometer[i] = addr[i];
      }
   }
  
   // show the addresses we found on the bus
   Serial.print("Using 1wire device: ");
   printAddress(thermometer);
   Serial.println();

   // set the resolution to 9 bit 
   sensors.setResolution(thermometer, 9);
  
   dhcpInit();
}
开发者ID:nAk123,项目名称:fluffyhome,代码行数:54,代码来源:FluffyHomeClientWithDHCP.cpp

示例15: setup

void setup()
{


  oled.begin();    // Initialize the OLED
  oled.clear(ALL); // Clear the display's internal memory
  oled.display();  // Display what's in the buffer (splashscreen)
  delay(1000);     // Delay 1000 ms
  oled.clear(PAGE); // Clear the buffer.
  // display the version at boot for 2 seconds
  oled.setFontType(1);
  oled.setCursor(0,8);
  oled.print(FILENAME);
  oled.setCursor(0,24);
  oled.print(MYVERSION);
  oled.display();
  oled.setFontType(0);
  delay(5000);

  request.port = 80;
  request.hostname = "things.ubidots.com";
  Serial.begin(9600);
  sensor.begin();

  Particle.variable("count_devices", &deviceCount, INT);
  Particle.function("q", queryDevices);
  Particle.function("setmode", setModeFunc);
  Particle.function("printEEProm", printEEPROMFunc);
  Particle.function("relay", relayFunc);

  //Need to set the device Index Array at startup
  deviceCount = getDeviceCount();
  queryDevices("auto");

  Particle.publish("reboot",Time.timeStr() );

     //encoder
  pinMode(encoderA, INPUT_PULLUP);
  pinMode(encoderB, INPUT_PULLUP);
  pinMode(button,INPUT_PULLUP);
  pinMode(relay, OUTPUT);
  attachInterrupt(encoderA, doEncoderA, CHANGE);
  attachInterrupt(encoderB, doEncoderB, CHANGE);

 // temperatureJob();  // do this one time so the first screen gets displayed





}
开发者ID:RobertNewkirk,项目名称:particle,代码行数:51,代码来源:endevor2.cpp


注:本文中的DallasTemperature::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。