本文整理汇总了C++中LCD::setCursor方法的典型用法代码示例。如果您正苦于以下问题:C++ LCD::setCursor方法的具体用法?C++ LCD::setCursor怎么用?C++ LCD::setCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LCD
的用法示例。
在下文中一共展示了LCD::setCursor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void ConfigMenuItem::Render(LCD& lcd, byte cols, byte rows) const {
size_t size = 0;
long value = m_value->Get();
// render label
lcd.setCursor(0, 0);
size = lcd.print(m_label);
Pad(lcd, cols, size);
// render value
lcd.setCursor(2, 1);
size = m_value->PrintValue(lcd);
Pad(lcd, cols - 4, size);
// render navigation
lcd.setCursor(0, 1);
if (value > m_value->GetMin()) {
lcd.print(ARROW_LEFT);
} else {
lcd.print(F(" "));
}
lcd.print(F(" "));
lcd.setCursor(cols - 2, 1);
lcd.print(F(" "));
if (value < m_value->GetMax()) {
lcd.print(ARROW_RIGHT);
} else {
lcd.print(F(" "));
}
}
示例2: main
int main()
{
signal(SIGINT, sig_handler);
LCD lcd;
LED led;
Knob knob;
Button button;
int knob_value = 0;
bool button_value = false;
char msg[18];
std::string ip;
led.on();
while( (ip = get_ip("wlan0")).length() == 0 )
{
lcd.clear();
lcd.write("looking for IP ");
sleep(1);
}
led.off();
lcd.clear();
lcd.setCursor(0, 0);
lcd.write("My IP Address:");
lcd.setCursor(1, 0);
lcd.write(ip.c_str());
sleep(3);
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(ip.c_str());
while( running == 0 )
{
lcd.setCursor(1, 0);
snprintf(msg, sizeof(msg), "knob: %d%% ", knob.percent());
lcd.write(msg);
if( button.value() )
{
led.on();
}
else
{
led.off();
}
if( (button_value != button.value()) || (knob.percent() != knob_value) )
{
button_value = button.value();
knob_value = knob.percent();
// post( button_value, knob_value );
}
usleep(100000);
}
return MRAA_SUCCESS;
}