нужна помощь в разъяснении работы библиотеки.
- Войдите на сайт для отправки комментариев
Добрый день!
Долго искал способ быстрого создания меню для ардуины и перепробовав доступные библиотеки меню остановился на MenuBackend.h.
все хорошо,но при ее использовании т.к не совсем понятен принцип работы возникли некоторые трудности.
например стоит задача изменять определенную переменную(например значение порога температуры)в подпункте2.
структура меню
Меню-Пункт -Подпункт1
-Подпункт2
если у меня один подпункт,то значения изменяются нормально.
но в случае ,если их 2 то у меня получается либо навигация по меню ,либо изменение только первого подпункта.
Обгладорить могу через веб-мани.
Вот ссылка на библиотеку.
http://www.arduino.cc/playground/uploads/Profiles/MenuBackend_1-4.zip
вот ссылка на пример
http://www.coagula.org/content/pages/tutorial-manage-menu-and-lcd-display-arduino#comment-2294
вот человек описывает подобную проблему
#include <Wire.h>
#include <Rtc_Pcf8563.h>
#include <MenuBackend.h> //MenuBackend library - copyright by Alexander Brevig
#include <LiquidCrystal.h> //this library is included in the Arduino IDE
const int encoderPushButton = 45; // pin for the Enter button
const int buttonPinEsc = 42; // pin for the Esc button
int encoder0PinA = 2;
int encoder0PinB = 3;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = HIGH;
int menuRoot = true;// A global flag. true = root (top) menu and display clock. false = don't display clock
int lastButtonPushed = 0;
int lastButtonEnterState = LOW; // the previous reading from the Enter input pin
int lastButtonEscState = LOW; // the previous reading from the Esc input pin
long lastEnterDebounceTime = 0; // the last time the output pin was toggled
long lastEscDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 150; // the debounce time
LiquidCrystal lcd(7,8,9,10,11,12);
Rtc_Pcf8563 rtc;//init the real time clock
// Time and Date
byte sec;
byte min;
byte hour;
byte day;
byte weekday;
byte month;
byte year;
byte century;
//Menu variables i.e. whats in the menu
MenuBackend menu = MenuBackend(menuUsed,menuChanged);
//initialize menuitems
MenuItem menuSetClock = MenuItem("menuSetClock"); // 2nd menu item
MenuItem menuItemHr = MenuItem("menuItemHr"); // sub menu
MenuItem menuItemMin = MenuItem("menuItemMin"); //sub menu
MenuItem menuExit = MenuItem("menuExit"); // 6th menu item
void setup()
{
lcd.begin(16, 2);
pinMode(encoderPushButton, INPUT);
pinMode(buttonPinEsc, INPUT);
pinMode (encoder0PinA,INPUT);
pinMode (encoder0PinB,INPUT);
//How the menu will look.
lcd.setCursor(0,0);
menu.getRoot().addRight(menuSetClock); // set main menu items
menuSetClock.add(menuItemHr).addRight(menuItemMin); // add first sub menu then addright additional sub menues for that menu
menuExit.add(menuExit);
menu.toRoot();
}
void loop()
{
if (menuRoot == true)
{
lcd.setCursor(4, 0);
lcd.print(rtc.formatTime());
lcd.setCursor(3, 1);
lcd.print(rtc.formatDate());
}
readButtons(); //I splitted button reading and navigation in two procedures because
readEncoder();
navigateMenus(); //in some situations I want to use the button for other purpose (eg. to change some settings)
{
}
}
void readButtons() //read buttons status
{
int reading;
int buttonEnterState=LOW; // the current reading from the Enter input pin
int buttonEscState=LOW; // the current reading from the input pin
//ENTER BUTTON DEBOUNCE
reading = digitalRead(encoderPushButton); // read the state of the switch into a local variable:
if (reading != lastButtonEnterState) // If the switch changed, due to noise or pressing:
{
lastEnterDebounceTime = millis(); // reset the debouncing timer
}
if ((millis() - lastEnterDebounceTime) > debounceDelay) // whatever the reading is at, it's been there for longerthan the debounce delay, so take it as the actual current state:
{
buttonEnterState=reading;
lastEnterDebounceTime=millis();
}
lastButtonEnterState = reading; // save the reading. Next time through the loop, it'll be the lastButtonState:
//ESC BUTTON DEBOUNCE
reading = digitalRead(buttonPinEsc); // read the state of the switch into a local variable:
if (reading != lastButtonEscState) // If the switch changed, due to noise or pressing:
{
lastEscDebounceTime = millis(); // reset the debouncing timer
}
if ((millis() - lastEscDebounceTime) > debounceDelay)// whatever the reading is at, it's been there for longerthan the debounce delay, so take it as the actual current state:
{
buttonEscState = reading;
lastEscDebounceTime=millis();
}
lastButtonEscState = reading; // save the reading. Next time through the loop, it'll be the lastButtonState:
//Records which button has been pressed
if (buttonEnterState==HIGH){
lastButtonPushed=encoderPushButton;
}
else if(buttonEscState==HIGH){
lastButtonPushed=buttonPinEsc;
}
else{
lastButtonPushed=0;
}
}
void readEncoder() //read the encoder and set lastButtonPushed to values used by navigateMenu()
{
n = digitalRead(encoder0PinA);// n is current state of encoder0PinA pin
if ((encoder0PinALast == HIGH) && (n == LOW)) // check if encoder0PinA pin has changed state
{
if (digitalRead(encoder0PinB) == LOW)
{
lastButtonPushed = 1; //if it has changed and its now low decrement encoder0Pos;
}
else
{
lastButtonPushed = 2; // if it has changed and its now high, increment encoder0Pos
}
}
encoder0PinALast = n; // set the variable holding the previous state to the value n read above
}
void menuChanged(MenuChangeEvent changed){
MenuItem newMenuItem=changed.to; //get the destination menu
lcd.setCursor(0,0); //set the start position for lcd printing to the second row
if(newMenuItem.getName()==menu.getRoot()){
lcd.clear();
menuRoot = true;
}
//MENU SET CLOCK
else if(newMenuItem.getName()=="menuSetClock"){
menuRoot = false;
lcd.clear();
lcd.print("Set Clock");
}
else if(newMenuItem.getName()=="menuItemHr"){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Hr");
}
else if(newMenuItem.getName()=="menuItemMin"){
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Min");
}
}
void menuUsed(MenuUseEvent used){ // **if you have a function call it here**
if ( used.item == menuItemHr ){
lcd.clear();//etc.
lcd.setCursor(0, 0);
lcd.print(rtc.formatTime());
changeHour();
}
else if ( used.item == menuItemMin ){
lcd.clear();//etc.
lcd.setCursor(0, 0);
lcd.print(rtc.formatTime());
changeMin();
}
if ( used.item == menuExit ){
menu.toRoot();//etc.
}
}
void navigateMenus()
{
MenuItem currentMenu=menu.getCurrent();
switch (lastButtonPushed)
{
case encoderPushButton: // enter pin
if(!(currentMenu.moveDown()))//if the current menu has a child and enter has been pressed then navigate menu to item below
{
menu.use();
}
else //otherwise, if menu has no child and enter has been pressed---- the current menu is used
{
menu.moveDown();
}
break;
case buttonPinEsc:
lcd.clear();
menu.toRoot(); //back to main
break;
case 1: //Encoder right/buttonPinRight --:
menu.moveRight();
break;
case 2: //Encoder left/buttonPinLeft ++:
menu.moveLeft();
break;
}
lastButtonPushed=0; //reset the lastButtonPushed variable
}
void changeMin(){
//min=rtc.getMinute();
if(digitalRead(encoderPushButton) == HIGH)
{
min = ++min % 60; // this is better than // min += 1;as it rolls overfrom 59 to 00
//if (incrementMinuteButtonPressDectected) min = ++min % 60 // increment and rollover past 59
//if (decrementMinuteButtonPressDectected) min = (--min + 60) % 60 // decrement and rollunder past 0
}
rtc.setTime(hour, min,sec);
}
void changeHour(){
// hour=rtc.getHour();
if(digitalRead(encoderPushButton) == HIGH)
{
hour = ++hour % 24; // this is better than // hour += 1;as it rolls overfrom 59 to 00
//if (incrementMinuteButtonPressDectected) hour = ++hour % 60 // increment and rollover past 59
//if (decrementMinuteButtonPressDectected) hour = (--hour + 60) % 60 // decrement and rollunder past 0
}
rtc.setTime(hour, min,sec);
rtc.setTime(sec, min, hour);
}
void changeDay(){
// Yet to be done
if(digitalRead(encoderPushButton) == HIGH)
{
day = ++day % 32; // this is better than // day += 1;as it rolls overfrom 59 to 00
//if (incrementMinuteButtonPressDectected) dayn = ++day % 31 // increment and rollover past 59
//if (decrementMinuteButtonPressDectected) day = (--day + 31) % 31 // decrement and rollunder past 0
}
rtc.setDate(day,weekday, month, century, year);
}
и вот мой код
include <DallasTemperature.h> //датчик температуры
#include <OneWire.h> //1 проводной интерфейс
#include <LiquidCrystal_I2C.h> //экран и2с
#include <Wire.h> // 1-проводной интерфейс
#include <MenuBackend.h> //меню
///////////////////темп обозначения
#define ONE_WIRE_BUS 3 // номер пина датчик температуры даллас 18б20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/////////////////////////////****************назначение пинов***********************************
//////////////////кнопки управления
const int buttonPinLeft = 9; // pin for the Up button
const int buttonPinRight = 7; // pin for the Down button
const int buttonPinEsc = 8; // pin for the Esc button
const int buttonPinEnter = 6; // pin for the Enter button
/////////////управление моторами и нагревателем
const int svet_pin =0 ;//пин света
const int nagr_pin =1 ; // пин нагрева
////////////переменные для времени
long prevmicros = 0;//переменная для хранения значений таймера
int sek=0;//значение секунд
int minu=0;//значение минут
int chas=10;//значение часов
boolean counter=false; // счетчик для полусекунд
unsigned int Temp = 24;
int Hister =1;
int svetvkl = 10;
int svetvikl = 0;
int a = 0;//для гистерезиса
int b = 0;//для гистерезиса
int z = 0; //переменная температуры с датчика
int menuRoot = true;// условие вывода меню или осн.экрана
int lastButtonPushed = 0;
float temperature = 0.0; //переменная температуры
int lastButtonEnterState = LOW; // the previous reading from the Enter input pin
int lastButtonEscState = LOW; // the previous reading from the Esc input pin
int lastButtonLeftState = LOW; // the previous reading from the Left input pin
int lastButtonRightState = LOW; // the previous reading from the Right input pin
long lastEnterDebounceTime = 0; // the last time the output pin was toggled
long lastEscDebounceTime = 0; // the last time the output pin was toggled
long lastLeftDebounceTime = 0; // the last time the output pin was toggled
long lastRightDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 300; // задержка клавиш
// Включение экрана и2с
LiquidCrystal_I2C lcd(0x27, 16, 2);
//Переменные меню ,здесь создается структура меню
MenuBackend menu = MenuBackend(menuUsed,menuChanged);
//initialize menuitems
MenuItem menu1Item1 = MenuItem("Item1");
MenuItem menuItem1SubItem1 = MenuItem("Item1SubItem1");
MenuItem menuItem1SubItem2 = MenuItem("Item1SubItem2");
MenuItem menu1Item2 = MenuItem("Item2");
MenuItem menuItem2SubItem1 = MenuItem("Item2SubItem1");
MenuItem menuItem2SubItem2 = MenuItem("Item2SubItem2");
MenuItem menu1Item3 = MenuItem("Item3");
///////////////////////////////****************установка значений программы************************
void setup()
{
///////////////////////// состояние пинов
//кнопки управления
pinMode(buttonPinLeft, INPUT);
pinMode(buttonPinRight, INPUT);
pinMode(buttonPinEnter, INPUT);
pinMode(buttonPinEsc, INPUT);
//нагреватель,моторы
pinMode(svet_pin, OUTPUT);
pinMode(nagr_pin, OUTPUT);
// Start up the library(темп??)
Serial.begin(9600);
sensors.begin();
//включение экрана
lcd.init();
lcd.backlight();
//переходы в меню (установить для левой кнопки!!!!!!!!!!!!!!!!!!!!!!!!
menu.getRoot().add(menu1Item1);
//**************
menu1Item1.addRight(menu1Item2).addRight(menu1Item3).addRight(menu1Item1);
menu1Item1.addLeft(menu1Item3).addLeft(menu1Item2).addLeft(menu1Item1);
//**************
menu1Item1.add(menuItem1SubItem1).addRight(menuItem1SubItem2).addRight(menuItem1SubItem1);
menuItem1SubItem1.addLeft(menuItem1SubItem2).addLeft(menuItem1SubItem1);
//**************
menu1Item2.add(menuItem2SubItem1).addRight(menuItem2SubItem2).addRight(menuItem2SubItem1);
menu.toRoot();
/////////////////////////////приветствие///////////////////
lcd.setCursor(3,0);
lcd.print("Kontroller ");
lcd.setCursor(6,1);
lcd.print("v.1.0");
delay (4000);
lcd.clear();
} // setup()...
void loop()
{
readButtons(); //считывание кнопок программа
navigateMenus(); //программа меню
////////////////////////**************************часы*********************************//////////
if (micros() - prevmicros >=500000)
{ prevmicros = micros(); //принимает значение каждые полсекунды lcd.print(":"); counter=!counter;
if (counter==false)
{ sek++; //переменная секунда + 1
lcd.setCursor(2,0);
}
else
{
lcd.setCursor(2,0);
lcd.print(" ");
}
if(sek>59)//если переменная секунда больше 59 ...
{
sek=0;//сбрасываем ее на 0
minu++;//пишем +1 в переменную минута
}
if(minu>59)//если переменная минута больше 59 ...
{
minu=0;//сбрасываем ее на 0
chas++;//пишем +1 в переменную час
}
if(chas>23)//если переменная час больше 23 ...
{
chas=0;//сбрасываем ее на 0
}
}
///////////////////////////*********************** основной экран с выводом параметров*************************
if (menuRoot == true) //задание выполнения считывания датчиков в основном выводе(без меню)
{
///////////////////////////////////////время////////////////////////////////
lcd.setCursor(0,0);//выводим значение часов
if (chas>=0 && chas<10) {
lcd.print("0");
lcd.print(chas);}//количество часов
else
{lcd.print(chas);
lcd.setCursor(3,0);}//выводим значение минут
if (minu>=0 && minu<10) {
lcd.print("0");
lcd.print(minu);}//количество минут
else
{lcd.print(minu);}
////////////////////////////////////////датчик температуры/////////////////////
sensors.requestTemperatures();
z = sensors.getTempCByIndex(0);
lcd.setCursor(0,1);
lcd.print ("T=");
lcd.print (z);
lcd.print ("C");
/////////////////////////////////////показание работы тем-ры/////////////////////
lcd.setCursor(7,1);
lcd.print ("Nagr:");
if (z <= b){
lcd.setCursor(12,1);
lcd.print ("ON ");
}
else
if (z >= a){
lcd.setCursor(12,1);
lcd.print ("OFF");
}
///////////////////////////////////показание работы света////////////////////////
lcd.setCursor(7,0);
lcd.print ("Svet:");
if (svetvkl == chas){
lcd.setCursor(12,0);
lcd.print ("ON ");
}
else
if (svetvkl != chas){
lcd.setCursor(12,0);
lcd.print ("OFF");}
//////////////////////////////////////////////////*********************действия контроллера в зависимости от датчиков*******************
/////////////////////////////////действие температуры///////////////////////////////////
a = Temp+Hister;
b = Temp-Hister;
if (z <= b){
digitalWrite(nagr_pin, HIGH);
}
else
if (z >= a){
digitalWrite(nagr_pin, LOW);}
//////////////////////////////действие света от часов///////////////////////////////////
if (svetvkl == chas)
{
digitalWrite(svet_pin, HIGH);
Serial.print ("ne vklycheno");
}
else if (svetvikl == minu)
{
digitalWrite(svet_pin, HIGH);
Serial.print ("22222222222222");
}
//loop()...
}
}
void menuChanged(MenuChangeEvent changed){
MenuItem newMenuItem=changed.to; //get the destination menu
lcd.setCursor(0,1); //set the start position for lcd printing to the second row
if(newMenuItem.getName()==menu.getRoot()){
menuRoot = true;
}else if(newMenuItem.getName()=="Item1"){
menuRoot = false;
lcd.setCursor(0,0);
lcd.print(" Main Menu ");
lcd.setCursor(0,1);
lcd.print("1)Temperatura ");
}else if(newMenuItem.getName()=="Item1SubItem1"){
lcd.setCursor(0,0);
lcd.print("1)Temperatura ");
lcd.setCursor(0,1);
lcd.print("Temp. podderzh.");
}else if(newMenuItem.getName()=="Item1SubItem2"){
lcd.setCursor(0,0);
lcd.print("1)Temperatura ");
lcd.setCursor(0,1);
lcd.print("Histerezis");
}else if(newMenuItem.getName()=="Item2"){
lcd.setCursor(0,0);
lcd.print(" Main Menu ");
lcd.setCursor(0,1);
lcd.print("2)Svet ");
}else if(newMenuItem.getName()=="Item2SubItem1"){
lcd.setCursor(0,0);
lcd.print("2)Svet ");
lcd.setCursor(0,1);
lcd.print("Vremya vklychenia");
}else if(newMenuItem.getName()=="Item2SubItem2"){
lcd.setCursor(0,0);
lcd.print("2)Svet ");
lcd.setCursor(0,1);
lcd.print("Vremya vIklychenia");
}else if(newMenuItem.getName()=="Item3"){
lcd.setCursor(0,0);
lcd.print(" Main Menu ");
lcd.setCursor(0,1);
lcd.print("Item3 ");
}
}
void menuUsed(MenuUseEvent used){
lcd.setCursor(0,0);
lcd.print("You used ");
lcd.setCursor(0,1);
lcd.print(used.item.getName());
menu.toRoot(); //back to Main
}
void readButtons(){ //read buttons status
int reading;
int buttonEnterState=LOW; // the current reading from the Enter input pin
int buttonEscState=LOW; // the current reading from the input pin
int buttonLeftState=LOW; // the current reading from the input pin
int buttonRightState=LOW; // the current reading from the input pin
//Enter button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinEnter);
// check to see if you just pressed the enter button
// (i.e. the input went from LOW to HIGH), and you've waited
// long enough since the last press to ignore any noise:
// If the switch changed, due to noise or pressing:
if (reading != lastButtonEnterState) {
// reset the debouncing timer
lastEnterDebounceTime = millis();
}
if ((millis() - lastEnterDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
buttonEnterState=reading;
lastEnterDebounceTime=millis();
}
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
lastButtonEnterState = reading;
//Esc button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinEsc);
// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH), and you've waited
// long enough since the last press to ignore any noise:
// If the switch changed, due to noise or pressing:
if (reading != lastButtonEscState) {
// reset the debouncing timer
lastEscDebounceTime = millis();
}
if ((millis() - lastEscDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
buttonEscState = reading;
lastEscDebounceTime=millis();
}
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
lastButtonEscState = reading;
//Down button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinRight);
// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH), and you've waited
// long enough since the last press to ignore any noise:
// If the switch changed, due to noise or pressing:
if (reading != lastButtonRightState) {
// reset the debouncing timer
lastRightDebounceTime = millis();
}
if ((millis() - lastRightDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
buttonRightState = reading;
lastRightDebounceTime =millis();
}
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
lastButtonRightState = reading;
//Up button
// read the state of the switch into a local variable:
reading = digitalRead(buttonPinLeft);
// check to see if you just pressed the Down button
// (i.e. the input went from LOW to HIGH), and you've waited
// long enough since the last press to ignore any noise:
// If the switch changed, due to noise or pressing:
if (reading != lastButtonLeftState) {
// reset the debouncing timer
lastLeftDebounceTime = millis();
}
if ((millis() - lastLeftDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
buttonLeftState = reading;
lastLeftDebounceTime=millis();;
}
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
lastButtonLeftState = reading;
//records which button has been pressed
if (buttonEnterState==HIGH){
lastButtonPushed=buttonPinEnter;
}else if(buttonEscState==HIGH){
lastButtonPushed=buttonPinEsc;
}else if(buttonRightState==HIGH){
lastButtonPushed=buttonPinRight;
}else if(buttonLeftState==HIGH){
lastButtonPushed=buttonPinLeft;
}else{
lastButtonPushed=0;
}
}
void navigateMenus()///////////////навигация по меню
{
MenuItem currentMenu=menu.getCurrent();
switch (lastButtonPushed){
//////////////////////выбор кнопки********************//////////////////////////////////
case buttonPinEnter:
////////////температура******************************
if(currentMenu.getName() == "Item1SubItem1"){ //otherwise, if menu has no child and has been pressed enter the current menu is used
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature= ");
lcd.print(Temp);
lcd.setCursor(0,1);
lcd.print ("Ustanovite znach");}
else if(currentMenu.getName() == "Item1SubItem2"){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Histerezis= ");
lcd.print(Hister);
lcd.setCursor(0,1);
lcd.print ("Ustanovite znach");
}
////////////свет******************************
else if(currentMenu.getName() == "Item2SubItem1")
{lcd.clear();
lcd.setCursor(0,0);
lcd.print("Vremya = ");
lcd.print (chas);
lcd.print(":");
lcd.print(minu);
lcd.setCursor(0,1);
lcd.print ("Ustanovite znach");
}
else
lcd.clear();
menu.moveDown();
break;
//////////////////выход*******************************/////////////////////////////////////
case buttonPinEsc:
lcd.clear();
menu.toRoot(); //back to main
break;
////////////////////вправо*************************/////////////////////////////////////////
case buttonPinRight://вправо
////////////температура******************************
if(currentMenu.getName() == "Item1SubItem1") // In setting the number of meals
{
Temp=Temp+1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(Temp);}
else if(currentMenu.getName() == "Item1SubItem2") // In setting the number of meals
{
Hister=Hister+1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(Hister);
}
////////////свет******************************
else if(currentMenu.getName() == "Item2SubItem1") // In setting the number of meals
{
svetvkl=svetvkl+1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(svetvkl);
}
else if(currentMenu.getName() == "Item2SubItem2") // In setting the number of meals
{
svetvikl=svetvikl+1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(svetvikl);
}
menu.moveRight();
break;
////////////влево****************************///////////////////////////////////////////////
case buttonPinLeft:///влево
if(currentMenu.getName() == "Item1SubItem2") // In setting the number of meals
{
Hister=Hister-1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(Hister);
}
else if(currentMenu.getName() == "Item1SubItem1") // In setting the number of meals
{
Temp=Temp-1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(Temp);
}
////////////свет******************************
else if(currentMenu.getName() == "Item2SubItem1") // In setting the number of meals
{
svetvkl=svetvkl-1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(svetvkl);
}
else if (currentMenu.getName() == "Item2SubItem2")
{
svetvikl=svetvikl-1; //if Right button is press Meals+1
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Ustanivite znachenie");
lcd.setCursor(0,1);
lcd.print(svetvikl);
}
menu.moveLeft();
break;
}
lastButtonPushed=0; //reset the lastButtonPushed variable
}
Обгладорить могу через веб-мани.
жуть какая...
предлагайте через что.
и да,там буква Т потерялась.
если надо распишу код,что и где.
...там буква Т потерялась....
Боюсь спросить - где?
Да,точно.
вообще с кодом голова не работает.
Там должно быть "отблагодарю".
а по делу что?
можно удалять.
проблема решена