本文整理汇总了C++中LiquidCrystal_I2C::init方法的典型用法代码示例。如果您正苦于以下问题:C++ LiquidCrystal_I2C::init方法的具体用法?C++ LiquidCrystal_I2C::init怎么用?C++ LiquidCrystal_I2C::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LiquidCrystal_I2C
的用法示例。
在下文中一共展示了LiquidCrystal_I2C::init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
LCD::LCD(Cooler *cooler, CheeseDHT *dhtUp, CheeseDHT *dhtDown, CheeseLog* logger) {
this->cooler = cooler;
this->logger = logger;
this->dhtUp = dhtUp;
this->dhtDown = dhtDown;
Wire.begin(4, 5);
currentLCD.init();
currentLCD.backlight();
counter = 0;
}
示例2: setup
//The setup function is called once at startup of the sketch
void setup() {
Serial.begin(9600);
lastMotionDetected = millis();
lastTrigger = millis();
pinMode(SDA_PIN, INPUT_PULLUP);
pinMode(SCL_PIN, INPUT_PULLUP);
lcd.init();
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), sensorChange, FALLING);
attachInterrupt(digitalPinToInterrupt(MOTION_DETECTOR_PIN), motionDetected,
CHANGE);
dht.begin();
delay(3000);
}
示例3: setup
void setup() {
Serial.begin(9600);
pinMode(SOILSENSOR, INPUT);
pinMode(PUMPPIN, OUTPUT);
// initialize the LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Initializing...");
dht.begin();
}
示例4: enableAfterSleep
void WeatherStation::enableAfterSleep()
{
uint8_t i;
volatile uint8_t *out, *ddr;
uint16_t diffMinutes;
//enable power
digitalWrite( PALETTE_PIN_MVCC, LOW );
pinMode( PALETTE_PIN_MVCC, OUTPUT );
delay(50); //waiting power stable
/**recovery ports**/
for( i = 0; i < PALETTE_PORT_NUM; i++ )
{
ddr = portModeRegister(ioPort[i]);
out = portOutputRegister(ioPort[i]);
*ddr = ioPreDDRValue[i];
*out = ioPrePORTValue[i];
}
sensorMgt.start();
lcd.init(); //need sometimes
if ( EVENT_STATE_SET == eventButtonState )
{
lcd.backlight();
setCurrentDate();
diffMinutes = (uint16_t)(runHours - buttonPressHours) * 60 + currentMinute - buttonPressMinute;
if ( (!displayMgt.statisticFlag) || (diffMinutes >= RESTART_DISPLAY_OVERTIME) )
{
clrDisplayMgt();
}
}
for ( i = 0; i < ACTION_NUMBER; i++ )
{
a_actionList[i].state = STATE_INIT;
}
startTime = (uint8_t)(millis()/1000);
}
示例5: setup
/*********************
* Setup function
* *******************/
void setup() {
time_t start, fadeIn, stop, fadeOut;
Wire.begin();
setSyncProvider(RTC.get);
lcd.init();
lcd.noBacklight();
led.loadEepromDatas();
pinMode(ledPin, OUTPUT);
kpd.init();
initMenuItems();
}
示例6: setup
void setup()
{
target_lat[1] = TARGET_1_LAT;
target_lon[1] = TARGET_1_LON;
target_lat[2] = TARGET_2_LAT;
target_lon[2] = TARGET_2_LON;
target_lat[3] = TARGET_3_LAT;
target_lon[3] = TARGET_3_LON;
target_lat[4] = TARGET_4_LAT;
target_lon[4] = TARGET_4_LON;
target_lat[5] = TARGET_5_LAT;
target_lon[5] = TARGET_5_LON;
target_lat[6] = TARGET_6_LAT;
target_lon[6] = TARGET_6_LON;
target_lat[7] = TARGET_7_LAT;
target_lon[7] = TARGET_7_LON;
target_lat[8] = TARGET_8_LAT;
target_lon[8] = TARGET_8_LON;
target_lat[9] = TARGET_9_LAT;
target_lon[9] = TARGET_9_LON;
target_lat[10] = TARGET_10_LAT;
target_lon[10] = TARGET_10_LON;
target_lat[11] = TARGET_11_LAT;
target_lon[11] = TARGET_11_LON;
target_lat[12] = TARGET_12_LAT;
target_lon[12] = TARGET_12_LON;
target_lat[13] = TARGET_13_LAT;
target_lon[13] = TARGET_13_LON;
target_lat[14] = TARGET_14_LAT;
target_lon[14] = TARGET_14_LON;
target = EEPROM.read(EEPROM_TARGET_INDEX);
if(target > NUMBER_OF_TARGETS+2 || target == 0 /*|| TARGET_RESET > 0*/) {
target = 1;
EEPROM.write(EEPROM_TARGET_INDEX, target);
}
// Force next step on strtup
//target++;
//EEPROM.write(EEPROM_TARGET_INDEX, target);
// Init pin outputs
pinMode(BATTERY_VOLTAGE_PIN, INPUT);
pinMode(BUTTON_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(SERVO_ON_PIN, OUTPUT);
pinMode(ON_PIN, INPUT);
pinMode(LCD_POWER_PIN, OUTPUT);
pinMode(GPS_RX_PIN, INPUT);
digitalWrite(LCD_POWER_PIN, 1);
digitalWrite(SERVO_ON_PIN, 0);
servo.attach(SERVO_PIN);
analogReference(EXTERNAL);
ss.begin(9600);
Serial.begin(115200);
lcd.init();
lcd.backlight();
lcd_welcome(lcd);
wait w;
w.set_time(3000);
w.start();
wait sim;
w.set_time(30000);
sim.set_steps(7);
sim.start();
Serial.print(F("Free RAM:")); Serial.println(freeRam());
Serial.println(F("Setup done."));
}
示例7: init
void WeatherStation::init( DataConfig *p_dataConfig, uint8_t dataNum )
{
uint8_t i, index;
DataConfig *p_dataConfigRecord = NULL;
/**init config table**/
p_dataConfigRecord = p_dataConfig;
index = 0;
DBG_PRINTLN("measure table:");
for( i = 0; i < dataNum; i++ )
{
a_measureData[index].p_sensor = sensorMgt.creatObject( p_dataConfigRecord->sensorID, p_dataConfigRecord->attachPin, p_dataConfigRecord->auxiliaryPin );
if ( NULL == a_measureData[index].p_sensor )
{
String info;
info = "Error: Rule No.";
info += (i+1);
showErrInfo( info );
break;
}
a_measureData[index].dataType = p_dataConfigRecord->type;
a_measureData[index].valid = true;
dataHouse.addDataTypeIndex(a_measureData[index].dataType);
DBG_PRINTLN_VAR(index, DEC);
DBG_PRINTLN_VAR((word)a_measureData[index].p_sensor, HEX);
index++;
p_dataConfigRecord++;
}
measureNum = index;
//todo enable power
digitalWrite( PALETTE_PIN_MVCC, LOW );
pinMode( PALETTE_PIN_MVCC, OUTPUT );
delay(500); //waiting power stable
/**init devices**/
Wire.begin();
RTCObj.begin();
lcd.init();
lcd.backlight();
setCurrentDate();
dataHouse.init( currentYear, currentMonth, currentDate, currentHour );
sensorMgt.start();
/**get the state of Switch**/
pinMode(PALETTE_PIN_SW, INPUT_PULLUP);
switchState = digitalRead(PALETTE_PIN_SW);
/**attach interrupt**/
pinMode(STAION_PIN_RTC_INT, INPUT_PULLUP);
pinMode(STAION_PIN_BUTTON, INPUT );
PCattachInterrupt( STAION_PIN_RTC_INT );
PCattachInterrupt( STAION_PIN_BUTTON );
RTCObj.clearINTStatus();
#if _DEBUG
RTCObj.enableInterrupts(EveryMinute);
#else
RTCObj.enableInterrupts(EveryHour);
#endif
/**Start**/
pinMode(PALETTE_PIN_BLK, OUTPUT);
digitalWrite(PALETTE_PIN_BLK,HIGH);
startTime = (uint8_t)(millis()/1000);
/**emulate pushing button**/
setEvent( STAION_PIN_BUTTON );
}
示例8: setup
void setup()
{
tmElements_t currentTime;
currentTime.Second = 0;
currentTime.Minute = 35;
currentTime.Hour =18;
currentTime.Wday = 5;
currentTime.Day = 17;
currentTime.Month = 4;
currentTime.Year = 44;
// RTC.set(makeTime(currentTime));
Serial.begin(9600);
Serial.println("TerraMonitor starting ...");
Wire.begin();
// analogReference(INTERNAL);
Serial.print("EEPROM HumidityController size occupied (in bytes) : ");
Serial.println(EEPROM_HUMIDITY_CONTROLLER_SIZE);
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus()!= timeSet)
Serial.println("Unable to sync with the RTC");
else
Serial.println("RTC has set the system time");
/* Controller Alarm init */
humidityController.initAlarms();
lightController.initAlarms();
/* read the sensor every s */
lowSensor.setInterval(5000);
highSensor.setInterval(5000);
/* read the sensor every 10s */
humidTempSensor.setInterval(10000);
/* run temp controller every s */
tempController.setInterval(1000);
/* add the thread to the controller */
controller.add(&lowSensor);
controller.add(&highSensor);
controller.add(&humidTempSensor);
controller.add(&tempController);
Timer1.initialize(100000);
Timer1.attachInterrupt(timerCallback);
// Alarms
//Alarm.alarmRepeat(12,00,0, MorningAlarm); // 8:30am every day
// Alarm.alarmRepeat(14,48,0, MorningAlarm); // 8:30am every day
//Alarm.alarmRepeat(17,30,0, MorningAlarm); // 8:30am every day
//Alarm.alarmRepeat(22,15,0, MorningAlarm); // 8:30am every day
humidityController.disableAllAlarms();
humidityController.setAlarm(0, 12, 0, 0, 30);
humidityController.setAlarm(1, 14, 0, 0, 15);
humidityController.setAlarm(2, 16, 0, 0, 15);
humidityController.setAlarm(3, 20, 0, 0, 15);
humidityController.setAlarm(4, 22, 15, 0, 20);
// humidityController.setAlarm(4, 16, 10, 0, 10);
lightController.setStartTime(11,30,0);
lightController.setStopTime(23,30,0);
tempController.setMaxUpperTemp(29);
tempController.setMinDayLowerTemp(21);
tempController.setMinNightLowerTemp(20);
tempController.setMinNightUpperTemp(21);
// extractFan.startFan();
// sideFan.startFan();
// frontFan.startFan();
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
示例9: setup
// { SPECIAL FUNCTIONS -------------------------------------------------------
void setup(){
// Required if SYSTEM_MODE = SEMI_AUTOMATIC or MANUAL
// if(Particle.connected() == false){
// Particle.connect();
// }
pinMode(BOARD_LED, OUTPUT); //INPUT, INPUT_PULLUP, INPUT_PULLDOWN or OUTPUT
// pinMode(DAC, OUTPUT); //INPUT, INPUT_PULLUP, INPUT_PULLDOWN or OUTPUT
// pinMode( D6, INPUT );
// attachInterrupt( D6, on_d6, CHANGE, 13);
// Note: do not set the pinMode() with analogRead(). The pinMode() is
// automatically set to AN_INPUT the first time analogRead() is called
// src: https://docs.particle.io/reference/firmware/photon/#analogread-adc-
// In other words, don't do: pinMode(analog_pin, INPUT);
// { Declare Cloud Variables/Functions/Events ----------------------------
// Up to 20 Variables
Particle.variable("help", HELP);
Particle.variable("a", PV_a);
Particle.variable("b", PV_a);
Particle.variable("c", PV_a);
// Up to 15 Functions.
Particle.function("do", PF_do);
Particle.function("set", PF_set);
#ifdef USE_STDIN
Particle.function("stdin", PF_stdin);
#endif // USE_STDIN
// Up to 4 Event Subscriptions
Particle.subscribe("all", PS_handler, MY_DEVICES);
// For documentation specify what events you will publish:
// Particle.publish("stdout", "...")
// Particle.publish("stderr", "...")
// } Declare Cloud Variables/Functions/Events ----------------------------
strcpy(PV_a, "Hello World");
#ifdef USE_LCD
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Hello World");
#endif
#ifdef USE_SERIAL0
Serial.begin(9600);
#endif // USE_SERIAL0
#ifdef USE_SERIAL1
Serial1.begin(9600);
#endif // USE_SERIAL1
#ifdef USE_TIMER_2SEC
timer_2sec.start();
#endif // USE_TIMER_2SEC
}