本文整理汇总了C++中LiquidCrystal_I2C::setCursor方法的典型用法代码示例。如果您正苦于以下问题:C++ LiquidCrystal_I2C::setCursor方法的具体用法?C++ LiquidCrystal_I2C::setCursor怎么用?C++ LiquidCrystal_I2C::setCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LiquidCrystal_I2C
的用法示例。
在下文中一共展示了LiquidCrystal_I2C::setCursor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init()
{
Serial.begin(SERIAL_BAUD_RATE);
Serial.systemDebugOutput(true); // Allow debug print to serial
Serial.println("Sming. Let's do smart things!");
Wire.pins(2, 0);
lcd.begin(16, 2);
lcd.backlight();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("DATE: 00/00/0000");
lcd.setCursor(0, 1);
lcd.print("TIME: 00:00");
// Station - WiFi client
WifiStation.enable(true);
WifiStation.config(WIFI_SSID, WIFI_PWD); // Put you SSID and Password here
// set timezone hourly difference to UTC
SystemClock.setTimeZone(7);
// Run our method when station was connected to AP (or not connected)
WifiStation.waitConnection(connectOk, 30, connectFail); // We recommend 20+ seconds at start
}
示例2: processButton
void WeatherStation::processButton()
{
#define GOTOSLEEP_TIME 2 //s
setCurrentDate();
buttonPressHours = runHours;
buttonPressMinute = currentMinute;
if ( DISPLAY_STATE_INIT == displayMgt.state )
{
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Weather Station"); //16
lcd.setCursor(0,1);
lcd.print("*** DFRobot ***"); //16
addAction(ACTION_SAMPLE_DATA);
}
addAction(ACTION_DISPLAY);
overTime = SLEEP_OVERTIME;
/**to avoid RTC interrupt when goto sleep **/
if ( (59 == currentMinute) && ( (currentSecond + overTime + GOTOSLEEP_TIME) >= 60 ))
{
overTime += (GOTOSLEEP_TIME + 1);
}
}
示例3: Update
void LCD::Update() {
if ((++counter) % 2 != 0) {
logger->Info("LCD update - data");
currentLCD.setCursor(0, 0);
String line1 = BriefTemp(dhtUp, "U") + BriefTemp(dhtDown, "D");
currentLCD.print(line1);
String line2 = "COOLER: " + String(cooler->IsWorking() ? "ON" : "OFF");
while (line2.length() < 16)
line2 += " ";
currentLCD.setCursor(0, 1);
currentLCD.print(line2);
} else {
logger->Info("LCD update - time");
String line1 = CheeseTime::DayOfWeek();
while (line1.length() < 16)
line1 += " ";
currentLCD.setCursor(0, 0);
currentLCD.print(line1);
String line2 = CheeseTime::Current();
while (line2.length() < 16)
line2 += " ";
currentLCD.setCursor(0, 1);
currentLCD.print(line2);
}
}
示例4: computeUserInput
time_t computeUserInput(uint8_t index, uint8_t number)
{
static time_t time;
uint8_t numberPosition = index;
uint8_t nextPosition = index + 1;
switch (index)
{
case 0:
if (number > 2)
number = 0;
time = 0;
time = hoursToTime_t(number * 10);
break;
case 1:
nextPosition = 3;
if (hour(time) >= 20 && number > 3)
number = 0;
time += hoursToTime_t(number);
break;
case 2:
numberPosition = 3;
nextPosition = 4;
if (number > 5)
number = 0;
time += minutesToTime_t(number * 10);
break;
case 3:
numberPosition = 4;
nextPosition = 6;
time += minutesToTime_t(number);
break;
case 4:
numberPosition = 6;
nextPosition = 7;
if (number > 5)
number = 0;
time += number * 10;
break;
case 5:
time += number;
numberPosition = 7;
nextPosition = 0;
lcd.setCursor(10,3);
lcd.print("OK : *");
break;
default:
return time;
}
lcd.setCursor(numberPosition,1);
lcd.print(number);
lcd.setCursor(numberPosition,2);
lcd.print(" ");
lcd.setCursor(nextPosition,2);
lcd.print("^");
return time;
}
示例5: setup
void setup()/*----( SETUP: RUNS ONCE )----*/
{
lcd.begin(20, 4); // initialize the lcd for 20 chars 4 lines and turn on backlight
// Open serial communications and wait for port to open:
Serial.begin(9600);
// --- button setup
pinMode(RunBtn, INPUT);
pinMode(ChangeScanBtn, INPUT);
digitalWrite(RunBtn, HIGH);
digitalWrite(ChangeScanBtn, HIGH);
pinMode(clampPin, OUTPUT); // sets the digital pin as OUTPUT to drive FET clamp)
pinMode(5, OUTPUT); // sets the digital pin as output
pinMode(6, OUTPUT); // sets the digital pin as output
pinMode(7, OUTPUT); // sets the digital pin as output
pinMode(11, OUTPUT); // pin11= PWM output / frequency output //Will Turner - This could go to pin 5 from 11. CHANGED TO 9 AS IT WOULDNT REACH OTHERS
// ------- Quick 3 blinks of backlight -------------
for (int i = 0; i < 3; i++)
{
lcd.backlight();
delay(20);
lcd.noBacklight();
delay(20);
}
lcd.backlight(); // finish with backlight on
//-------- Initialise display ----------------
// NOTE: Cursor Position: CHAR, LINE) start at 0
lcd.setCursor(0, 0); //Start at character 0 on line 0
lcd.print("Tension Tester v1.5 "); // sets up the screen for the wire number and layer number being recorded
lcd.setCursor(0, 2);
lcd.print(" Press Run ");
Setup_timer2();
// disable interrupts to avoid timing distortion
cbi (TIMSK0, TOIE0); // disable Timer0 !!! delay() is now not available
sbi (TIMSK2, TOIE2); // enable Timer2 Interrupt
dfreq = 1000.0; // initial output frequency = 1000.o Hz
tword_m = pow(2, 32) * dfreq / refclk; // calulate DDS new tuning word
// setup start and end frequencies of sweep
// setup initial values for loop
adcflag = false;
analogval = 0;
digitalWrite(clampPin, HIGH); // sets the pin high to short out large signals before amp (using a FET as clamp)
avgcnt = 0.0;
}
示例6: changeStopLedState
void changeStopLedState()
{
lcd.setCursor(0,0);
lcd.print("Stop light time :");
lcd.setCursor(0,1);
digitalClockDisplay(led.getStopTime());
lcd.setCursor(0,2);
lcd.print("^");
lcd.setCursor(0,3);
lcd.print("Back : #");
}
示例7: changeHourState
void changeHourState()
{
lcd.setCursor(0,0);
lcd.print("Type the time :");
lcd.setCursor(0,1);
digitalClockDisplay(now());
lcd.setCursor(0,2);
lcd.print("^");
lcd.setCursor(0,3);
lcd.print("Back : #");
}
示例8: changeFadeOutState
void changeFadeOutState()
{
lcd.setCursor(0,0);
lcd.print("Fade out light time :");
lcd.setCursor(0,1);
digitalClockDisplay(led.getFadeOutTime());
lcd.setCursor(0,2);
lcd.print("^");
lcd.setCursor(0,3);
lcd.print("Back : #");
}
示例9: init
void DisplayClass::init()
{
lcd.begin(20, 4); // initialize the lcd
lcd.home(); // go home
lcd.print(F(" WATER DISPENSER"));
lcd.setCursor(0, 1);
lcd.print(F(" Version: "VERSION""));
lcd.setCursor(0, 2);
lcd.print(F(" INITALIZING..."));
lcd.setCursor(0, 3);
lcd.print(F(" Tiago Conceicao"));
}
示例10: printWaitScreen
void printWaitScreen()
{
lcd.setCursor(0,0);
digitalClockDisplay(now());
lcd.setCursor(0,1);
lcd.print("Output : ");
lcd.print(percent);
lcd.print("%");
lcd.setCursor(0,3);
lcd.print("Menu : #");
}
示例11: loop
void loop() {
int sensorValue = analogRead(SOILSENSOR);
Serial.print(sensorValue); Serial.print(" - ");
if(sensorValue <= DRYNESS)
{
// if the soil is too dry start watering for 1.5 seconds then
// wait for seconds before monitoring again
Serial.println("Soil dry start watering");
digitalWrite(PUMPPIN, HIGH);
delay(WATERDELAY);
digitalWrite(PUMPPIN, LOW);
delay(WATERPOSTDELAY);
}
float h = dht.readHumidity();
float f = dht.readTemperature(true); // Fahrenheit
if (isnan(h) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(f, 1); // print only one decimal digit due to limited space
lcd.print("\337F");
lcd.setCursor(0, 1);
lcd.print("SoilMoisture:");
lcd.print(sensorValue);
// lcd.setCursor(0,1);
// lcd.print("Humidity: ");
// lcd.print(h, 1);
// lcd.print("%");
// Serial.print("Temp: ");
// Serial.print(f);
//
// Serial.print("Humidity: ");
// Serial.print(h);
//Serial.print("Soil Moisture: ");
//Serial.print(sensorValue);
delay(5000);
}
示例12: setPressure
void setPressure() {
lcd.clear();
lcd.print("Baromethric");
lcd.setCursor(0, 1);
lcd.print("10000");
lcd.print(" kPa");
}
示例13: echoSerial
void echoSerial(){
byte index=0;
char outa[20];
char outb[20];
outb[0]='\0';
boolean foundData=false;
while (Serial.available() > 0){
foundData=true;
if(index < 19){
outa[index]=Serial.read();
index++;
outa[index]= '\0';
}else{
if(index < 39){
outb[index-20]=Serial.read();
index++;
outb[index-20]= '\0';
}
}
}
if(foundData){
lcd.clear();
lcd.home();
lcd.print(outa);
lcd.setCursor ( 0, 1 );
lcd.print(outb);
}
}
示例14: startWebServer
void startWebServer()
{
server.listen(80);
server.addPath("/", onIndex);
server.addPath("/lcd", onLcd);
server.addPath("/volume", onVolume);
server.addPath("/mute", onMute);
server.addPath("/source", onSource);
server.addPath("/state", onState);
server.addPath("/power", onPower);
server.addPath("/tune", onTune);
server.addPath("/mixing", onMixing);
server.addPath("/enhance", onEnhance);
// Web Sockets configuration
server.enableWebSockets(true);
server.setWebSocketConnectionHandler(wsConnected);
server.setWebSocketMessageHandler(wsMessageReceived);
server.setWebSocketBinaryHandler(wsBinaryReceived);
server.setWebSocketDisconnectionHandler(wsDisconnected);
server.setDefaultHandler(onFile);
Serial.println("\r\n=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());
lcd.clear();
lcd.setCursor(1,1);
lcd.print(WifiStation.getIP());
}
示例15: setSource
void setSource(int sourc){
source = sourc;
int sourceID = 0;
lcd.home(); // go home
lcd.setCursor(0,1);
if( source == 0){
sourceID = 0xC7;
lcd.print(" 5.1 ");
}else if( source == 1){
sourceID = 0xCB;
lcd.print(" FM Radio ");
}else if( source == 2){
sourceID = 0xCA;
lcd.print(" AUX 2 ");
}else if( source == 3){
sourceID = 0xC9;
lcd.print(" AUX 3 ");
}else if( source == 4){
sourceID = 0xC8;
lcd.print(" AUX 4 ");
}
if(sourceID){
Wire.beginTransmission(PT2323_ADDRESS);
Wire.write(DEVICE_REG_MODE1);
Wire.write(sourceID);
Wire.endTransmission();
}
}