~cpp
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <SimpleTimer.h>
#include <WidgetRTC.h>
#include <TimeLib.h>
#include "Nextion.h"
SimpleTimer timer;
char auth[] = "xxxxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxx";
char pass[] = "xxxxxxxxxxx";
WidgetRTC rtc;
WidgetTerminal terminal(V0);
int conta =0;
float val=0;
float val1=0;
float val2=0;
float val3=0;
float val4=0;
float val5=0;
float val6=0;
float val7=0;
float val8=0;
float val9=0;
float val10=0;
float val11=0;
float val12=0;
float val13=0;
float val14=0;
float val15=0;
float val16=0;
float val17=0;
float val18=0;
float val19=0;
float val20=0;
float val21=0;
float val22=0;
float val23=0;
float val24=0;
float val25=0;
float val26=0;
float val27=0;
float val28=0;
float val29=0;
float val30=0;
float val31=0;
float val32=0;
float val33=0;
float val34=0;
float val35=0;
float val36=0;
float val37=0;
float val38=0;
float val39=0;
float val40=0;
float val41=0;
float val42=0;
float val43=0;
float val44=0;
float val45=0;
// 45 objetos que existen
const int buzz=D7;
const int led=D4;
float res=0;
int cod1;
int cod2;
int cod3;
float total=0 ;
// VARIABLES NUM CEVICHE
void n_cagPopCallback(void *ptr);
void n_camCallback(void *ptr);
void n_canPopCallback(void *ptr);
void n_filgPopCallback(void *ptr);
void n_filmPopCallback(void *ptr);
void n_filcPopCallback(void *ptr);
void n_fcgPopCallback(void *ptr);
void n_fcmPopCallback(void *ptr);
void n_fccPopCallback(void *ptr);
void n_mxgPopCallback(void *ptr);
void n_mxmPopCallback(void *ptr);
void n_mxcPopCallback(void *ptr);
void ok_ceviPopCallback(void *ptr);
// SUDADO NUM && BUTTON
void n_megPopCallback(void *ptr);
void n_memPopCallback(void *ptr);
void n_cabrigPopCallback(void *ptr);
void n_cabrimPopCallback(void *ptr);
void n_cabgPopCallback(void *ptr);
void n_cabmPopCallback(void *ptr);
void ok_sudPopCallback(void *ptr);
// MARISCOS NUM
/*
void n_amgPopCallback(void *ptr);
void n_ammPopCallback(void *ptr);
void n_pgPopCallback(void *ptr);
void n_pmPopCallback(void *ptr);
void n_sgPopCallback(void *ptr);
void n_smPopCallback(void *ptr);*/
void ok_marPopCallback(void *ptr);
// CHICARRONES NUM
void n_cpgPopCallback(void *ptr);
void n_cpmPopCallback(void *ptr);
void n_cplgPopCallback(void *ptr);
void n_cplmPopCallback(void *ptr);
void n_cmxgPopCallback(void *ptr);
void n_cmxmPopCallback(void *ptr);
void envia_chPopCallback(void *ptr);
// JALEA NUM
void n_jpgPopCallback(void *ptr);
void n_jpmPopCallback(void *ptr);
void n_jmgPopCallback(void *ptr);
void n_jmmPopCallback(void *ptr);
void n_jmxgPopCallback(void *ptr);
void n_jmxmPopCallback(void *ptr);
void envia_jalPopCallback(void *ptr);
// GASEOSAS NUM
void n_ingPopCallback(void *ptr);
void n_inpPopCallback(void *ptr);
void n_cogPopCallback(void *ptr);
void n_copPopCallback(void *ptr);
void n_pegPopCallback(void *ptr);
void n_pepPopCallback(void *ptr);
void ok_gasPopCallback(void *ptr);
// CERVEZAS NUM
void n_cuzPopCallback(void *ptr);
void n_crisPopCallback(void *ptr);
void n_pilPopCallback(void *ptr);
void n_nePopCallback(void *ptr);
void ok_cerPopCallback(void *ptr);
// MAIN PAGE
void ok_mainPopCallback(void *ptr);
void n_mesaPopCallback(void *ptr);
void page0PopCallback(void *ptr);
// DS CEVICHE
NexDSButton bcag = NexDSButton(1, 3, "bcag");
NexDSButton bcam = NexDSButton(1, 7, "bcam");
NexDSButton bcac = NexDSButton(1, 12, "bcac");
NexDSButton bfilg = NexDSButton(1, 4, "bfilg");
NexDSButton bfilm = NexDSButton(1, 8, "bfilm");
NexDSButton bfilc = NexDSButton(1, 13, "bfilc");
NexDSButton bfcg = NexDSButton(1, 5, "bfcg");
NexDSButton bfcm = NexDSButton(1, 9, "bfcm");
NexDSButton bfcc = NexDSButton(1, 14, "bfcc");
NexDSButton bmxg = NexDSButton(1, 6, "bmxg");
NexDSButton bmxm = NexDSButton(1, 10, "bmxm");
NexDSButton bmxc = NexDSButton(1, 15, "bmxc");
// DS SUDADO
NexDSButton btmeg = NexDSButton(3, 3, "btmeg");
NexDSButton btmem = NexDSButton(3, 6, "btmem");
NexDSButton btcabrig = NexDSButton(3, 4, "btcabrig");
NexDSButton btcabrim = NexDSButton(3, 7, "btcabrim");
NexDSButton btcabg = NexDSButton(3, 5, "btcabg");
NexDSButton btcabm = NexDSButton(3, 8, "btcabm");
// DS MARISCOS
NexDSButton bamg = NexDSButton(3, 4, "bamg");
NexDSButton bamm = NexDSButton(3, 10, "bamm");
NexDSButton bpg = NexDSButton(3, 5, "bpg");
NexDSButton bpm = NexDSButton(3, 11, "bpm");
NexDSButton bsa = NexDSButton(3, 6, "bsa");
NexDSButton bsm = NexDSButton(3, 12, "bsm");
// DS CHICHARRONES
NexDSButton bcpg = NexDSButton(4, 4, "bcpg");
NexDSButton bcpm = NexDSButton(4, 10, "bcpm");
NexDSButton bcplg = NexDSButton(4, 5, "bcplg");
NexDSButton bcplm = NexDSButton(4, 11, "bcplm");
NexDSButton bcmxg = NexDSButton(4, 6, "bcmxg");
NexDSButton bcmxm = NexDSButton(4, 12, "bcmxm");
// DS JALEA
NexDSButton bjpg = NexDSButton(5, 4, "bjpg");
NexDSButton bjpm = NexDSButton(5, 7, "bjpm");
NexDSButton bjmg = NexDSButton(5, 5, "bjmg");
NexDSButton bjmm = NexDSButton(5, 8, "bjmm");
NexDSButton bjmxg = NexDSButton(5, 6, "bjmxg");
NexDSButton bjmxm = NexDSButton(5, 9, "bjmxm");
// DS GASEOSA, ojo espaciado en las comillas genera, error d envio d info ejmplo "bting ", envia sin q cumpla condicion
NexDSButton bting = NexDSButton(6, 35, "bting");
NexDSButton btinp = NexDSButton(6, 10, "btinp");
NexDSButton btcog = NexDSButton(6, 4, "btcog");
NexDSButton btcop = NexDSButton(6, 11, "btcop");
NexDSButton btpeg = NexDSButton(6, 5, "btpeg");
NexDSButton btpep = NexDSButton(6, 12, "btpep");
// DS CERVEZA
NexDSButton btcuz = NexDSButton(7, 3, "btcuz");
NexDSButton btcris = NexDSButton(7, 4, "btcris");
NexDSButton btpil = NexDSButton(7, 5, "btpil");
NexDSButton btne = NexDSButton(7, 9, "btne");
// NUMBER ID CEVICHE
NexNumber n_cag = NexNumber(1, 40, "n_cag");
NexNumber n_cam = NexNumber(1, 52, "n_cam");
NexNumber n_cac = NexNumber(1, 56, "n_cac");
NexNumber n_filg = NexNumber(1, 49, "n_filg");
NexNumber n_film = NexNumber(1, 53, "n_film");
NexNumber n_filc = NexNumber(1, 57, "n_filc");
NexNumber n_fcg = NexNumber(1, 50, "n_fcg");
NexNumber n_fcm = NexNumber(1, 54, "n_fcm");
NexNumber n_fcc = NexNumber(1, 58, "n_fcc");
NexNumber n_mxg = NexNumber(1, 51, "n_mxg");
NexNumber n_mxm = NexNumber(1, 55, "n_mxm");
NexNumber n_mxc = NexNumber(1, 59, "n_mxc");
// NUMBER ID SUD
NexNumber n_meg = NexNumber(2, 22, "n_meg");
NexNumber n_mem = NexNumber(2, 25, "n_mem");
NexNumber n_cabrig = NexNumber(2, 23, "n_cabrig");
NexNumber n_cabrim = NexNumber(2, 26, "n_cabrim");
NexNumber n_cabg = NexNumber(2, 24, "n_cabg");
NexNumber n_cabm = NexNumber(2, 27, "n_cabm");
// NUMBER ID MARISCO
NexNumber n_amg = NexNumber(3, 25, "n_amg");
NexNumber n_amm = NexNumber(3, 28, "n_amm");
NexNumber n_pg = NexNumber(3, 26, "n_pg");
NexNumber n_pm = NexNumber(3, 29, "n_pm");
NexNumber n_sg = NexNumber(3, 27, "n_sg");
NexNumber n_sm = NexNumber(3, 30, "n_sm");
// NUMBER ID CHICHARRONES
NexNumber n_cpg = NexNumber(4, 4, "n_cpg");
NexNumber n_cpm = NexNumber(4, 10, "n_cpm");
NexNumber n_cplg = NexNumber(4, 5, "n_cplg");
NexNumber n_cplm = NexNumber(4, 11, "n_cplm");
NexNumber n_cmxg = NexNumber(4, 6, "n_cmxg");
NexNumber n_cmxm = NexNumber(4, 12, "n_cmxm");
// NUMBER ID JALEA
NexNumber n_jpg = NexNumber(5, 25, "n_jpg");
NexNumber n_jpm = NexNumber(5, 28, "n_jpm");
NexNumber n_jmg = NexNumber(5, 26, "n_jmg");
NexNumber n_jmm = NexNumber(5, 29, "n_jmm");
NexNumber n_jmxg = NexNumber(5, 27, "n_jmxg");
NexNumber n_jmxm = NexNumber(5, 30, "n_jmxm");
// NUMBER ID GASEOSA
NexNumber n_ing = NexNumber(6, 36, "n_ing");
NexNumber n_inp = NexNumber(6, 28, "n_inp");
NexNumber n_cog = NexNumber(6, 26, "n_cog");
NexNumber n_cop = NexNumber(6, 29, "n_cop");
NexNumber n_peg = NexNumber(6, 27, "n_peg");
NexNumber n_pep = NexNumber(6, 30, "n_pep");
// NUMBER ID CERVEZA
NexNumber n_cuz = NexNumber(7, 19, "n_cuz");
NexNumber n_cris = NexNumber(7, 20, "n_cris");
NexNumber n_pil = NexNumber(7, 21, "n_pil");
NexNumber n_ne = NexNumber(7, 22, "n_ne");
// BUTTON COMMANDS OK
NexButton ok_cevi = NexButton(1, 11, "ok_cevi");
NexButton ok_sud = NexButton(2, 21, "ok_sud");
NexButton ok_mar = NexButton(3, 36, "ok_mar");
NexButton envia_ch = NexButton(4, 3, "envia_ch");
NexButton envia_jal = NexButton(5, 3, "envia_jal");
NexButton ok_gas = NexButton(6, 8, "ok_gas");
NexButton ok_cer = NexButton(7, 23, "ok_cer");
// MAIN PAGE
NexNumber n_mesa = NexNumber(0, 11, "n_mesa");
NexButton ok_main= NexButton(0, 9, "ok_main");
// PAGE
NexPage page0 = NexPage(0, 0, "page0");
char buffer[500] = {0};
NexTouch *nex_listen_list[] =
{
&page0, &n_cag, &n_cam, &n_cac, &n_filg, &n_film, &n_filc, &n_fcg, &n_fcm, &n_fcc, &n_mxg, &n_mxm, &n_mxc,
&bmxc,&bmxm, &bmxg, &bfcc, &bfcm, &bfcg, &bfilg, &bfilm, &bfilc, &bcag, &bcam, &bcac,&ok_cevi,&ok_main,&n_mesa,
&n_meg, &n_cabrig, &n_cabg, &n_mem, &n_cabrim, &n_cabm, &btmeg, &btcabrig, &btcabg, &btmem, &btcabrim, &btcabm,
&ok_sud,&n_cpg, &n_cpm, &n_cplg, &n_cplm, &n_cmxg, &n_cmxm,
&bcpg, &bcpm, &bcplg, &bcplm, &bcmxg, &bcmxm, &envia_ch, &n_jpg, &n_jpm, &n_jmg, &n_jmm, &n_jmxg, &n_jmxm, &bjpg, &bjpm, &bjmg, &bjmm, &bjmxg, &bjmxm, &envia_jal,
&n_ing, &n_inp, &n_cog, &n_cop, &n_peg, &n_pep,&bting, &btinp, &btcog, &btcop, &btpeg, &btpep, &ok_gas, &n_cuz, &n_cris, &n_pil, &n_ne, &btcuz, &btcris, &btpil, &btne, &ok_cer,
&n_amg,&n_amm,&n_pg,&n_pm,&n_sg,&n_sm,&bamg,&bamm, &bpg, &bpm, &bsa, &bsm, &ok_mar,
NULL
};
void ok_ceviPopCallback(void *ptr) // BOTON ENVIO CEVICHE
{
uint32_t number;
n_cag.getValue(&number);
int cabg= number;
uint32_t dual_state;
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 0, sizeof(buffer));
bcag.getValue(&dual_state);
if(dual_state)
{
terminal.print("Ceviche caballa, fuente grande");
terminal.print(" : ");
terminal.print(cabg);
terminal.println("");
terminal.flush();
val=cabg*35.00;
}
uint32_t number1;
n_cam.getValue(&number1);
int cabm= number1;
uint32_t dual_state1;
memset(buffer, 0, sizeof(buffer));
bcam.getValue(&dual_state1);
if(dual_state1)
{
terminal.print("Ceviche caballa, fuente mediana");
terminal.print(" : ");
terminal.print(cabm);
terminal.println("");
terminal.flush();
val1=cabm*25.00;
}
uint32_t number2;
n_cac.getValue(&number2);
int cabc= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
bcac.getValue(&dual_state2);
if(dual_state2)
{
terminal.print("Ceviche caballa, personal");
terminal.print(" : ");
terminal.print(cabc);
terminal.println("");
terminal.flush();
val2=cabc*15.00;
}
// filete
uint32_t number3;
n_filg.getValue(&number3);
int fig= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
bfilg.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("Ceviche filete, fuente grande");
terminal.print(" : ");
terminal.print(fig);
terminal.println("");
terminal.flush();
val3=fig*35.00;
}
uint32_t number4;
n_film.getValue(&number4);
int fim= number4;
uint32_t dual_state4;
memset(buffer, 0, sizeof(buffer));
bfilm.getValue(&dual_state4);
if(dual_state4)
{
terminal.print("Ceviche filete, fuente mediana");
terminal.print(" : ");
terminal.print(fim);
terminal.println("");
terminal.flush();
val4=fim*25.00;
}
uint32_t number5;
n_filc.getValue(&number5);
int fic= number5;
uint32_t dual_state5;
memset(buffer, 0, sizeof(buffer));
bfilc.getValue(&dual_state5);
if(dual_state5)
{
terminal.print("Ceviche filete, personal");
terminal.print(" : ");
terminal.print(fic);
terminal.println("");
terminal.flush();
val5=fic*15.00;
}
// cab fil
uint32_t number6;
n_fcg.getValue(&number6);
int fcg= number6;
uint32_t dual_state6;
memset(buffer, 0, sizeof(buffer));
bfcg.getValue(&dual_state6);
if(dual_state6)
{
terminal.print("Ceviche filete - caballa, fuente grande");
terminal.print(" : ");
terminal.print(fcg);
terminal.println("");
terminal.flush();
val6=fcg*37.00;
}
uint32_t number7;
n_fcm.getValue(&number7);
int fcm= number7;
uint32_t dual_state7;
memset(buffer, 0, sizeof(buffer));
bfcm.getValue(&dual_state7);
if(dual_state7)
{
terminal.print("Ceviche filete - caballa, fuente mediana");
terminal.print(" : ");
terminal.print(fcm);
terminal.println("");
terminal.flush();
val7=fcm*28.00;
}
uint32_t number8;
n_fcc.getValue(&number8);
int fcc= number8;
uint32_t dual_state8;
memset(buffer, 0, sizeof(buffer));
bfcc.getValue(&dual_state8);
if(dual_state8)
{
terminal.print("Ceviche filete - caballa, personal");
terminal.print(" : ");
terminal.print(fcc);
terminal.println("");
terminal.flush();
val8=fcc*18.00;
}
// MIXTO
uint32_t number9;
n_mxg.getValue(&number9);
int mxg= number9;
uint32_t dual_state9;
memset(buffer, 0, sizeof(buffer));
bmxg.getValue(&dual_state9);
if(dual_state9)
{
terminal.print("Ceviche mixto, fuente grande");
terminal.print(" : ");
terminal.print(mxg);
terminal.println("");
terminal.flush();
val9=mxg*40.00;
}
uint32_t number10;
n_mxm.getValue(&number10);
int mxm= number10;
uint32_t dual_state10;
memset(buffer, 0, sizeof(buffer));
bmxm.getValue(&dual_state10);
if(dual_state10)
{
terminal.print("Ceviche mixto, fuente mediana");
terminal.print(" : ");
terminal.print(mxm);
terminal.println("");
terminal.flush();
val10=mxm*30.00;
}
uint32_t number11;
n_mxc.getValue(&number11);
int mxc= number11;
uint32_t dual_state11;
memset(buffer, 0, sizeof(buffer));
bmxc.getValue(&dual_state11);
if(dual_state11)
{
terminal.print("Ceviche mixto, personal");
terminal.print(" : ");
terminal.print(mxc);
terminal.println("");
terminal.flush();
val11=mxc*20.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// BOTON ENVIO SUD
void ok_sudPopCallback(void *ptr){
uint32_t number12;
n_meg.getValue(&number12);
int meg= number12;
uint32_t dual_state12;
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 0, sizeof(buffer));
btmeg.getValue(&dual_state12);
if(dual_state12)
{
terminal.print("Sudado de mero, fuente grande");
terminal.print(" : ");
terminal.print(meg);
terminal.println("");
terminal.flush();
val12=meg*45.00;
}
uint32_t number13;
n_mem.getValue(&number13);
int mem= number13;
uint32_t dual_state13;
memset(buffer, 0, sizeof(buffer));
btmem.getValue(&dual_state13);
if(dual_state13)
{
terminal.print("Sudado de mero, mediana");
terminal.print(" : ");
terminal.print(mem);
terminal.println("");
terminal.flush();
val13=mem*35.00;
}
uint32_t number14;
n_cabrig.getValue(&number14);
int scabri=number14;
uint32_t dual_state14;
memset(buffer, 0, sizeof(buffer));
btcabrig.getValue(&dual_state14);
if(dual_state14)
{
terminal.print("Sudado de cabrilla, grande");
terminal.print(" : ");
terminal.print(scabri);
terminal.println("");
terminal.flush();
val14=scabri*45.00;
}
uint32_t number15;
n_cabrim.getValue(&number15);
int cabrim= number15;
uint32_t dual_state15;
memset(buffer, 0, sizeof(buffer));
btcabrim.getValue(&dual_state15);
if(dual_state15)
{
terminal.print("Sudado de cabrilla, mediana");
terminal.print(" : ");
terminal.print(cabrim);
terminal.println("");
terminal.flush();
val15=cabrim*35.00;
}
uint32_t number16;
n_cabg.getValue(&number16);
int scag= number16;
uint32_t dual_state16;
memset(buffer, 0, sizeof(buffer));
btcabg.getValue(&dual_state16);
if(dual_state16)
{
terminal.print("Sudado de caballa, grande");
terminal.print(" : ");
terminal.print(scag);
terminal.println("");
terminal.flush();
val16=scag*30.00;
}
uint32_t number17;
n_cabm.getValue(&number17);
int scam= number17;
uint32_t dual_state17;
memset(buffer, 0, sizeof(buffer));
btcabm.getValue(&dual_state17);
if(dual_state17)
{
terminal.print("Sudado de caballa, mediana");
terminal.print(" : ");
terminal.print(scam);
terminal.println("");
terminal.flush();
val17=scam*20.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// 0K MARISCOS
void ok_marPopCallback(void *ptr){
uint32_t number;
n_amg.getValue(&number);
int amg= number;
uint32_t dual_state;
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 0, sizeof(buffer));
bamg.getValue(&dual_state);
if(dual_state)
{
terminal.print("Arroz con mariscos fuente grande");
terminal.print(" : ");
terminal.print(amg);
terminal.println("");
terminal.flush();
val18=amg*30.00;
}
uint32_t number1;
n_amm.getValue(&number1);
int amm= number1;
uint32_t dual_state1;
memset(buffer, 0, sizeof(buffer));
bamm.getValue(&dual_state1);
if(dual_state1)
{
terminal.print("Arroz con mariscos fuente mediana");
terminal.print(" : ");
terminal.print(amm);
terminal.println("");
terminal.flush();
val19=amm*20.00;
}
uint32_t number2;
n_pg.getValue(&number2);
int pg= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
bpg.getValue(&dual_state2);
if(dual_state2)
{
terminal.print("Parihuela fuente grande");
terminal.print(" : ");
terminal.print(pg);
terminal.println("");
terminal.flush();
val20=pg*30.00;
}
uint32_t number3;
n_pm.getValue(&number3);
int pm= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
bpm.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("Parihuela fuente mediana");
terminal.print(" : ");
terminal.print(pm);
terminal.println("");
terminal.flush();
val21=pm*20.00;
}
uint32_t number4;
n_sg.getValue(&number4);
int sg= number4;
uint32_t dual_state4;
memset(buffer, 0, sizeof(buffer));
bsa.getValue(&dual_state4);
if(dual_state4)
{
terminal.print("Saltado de mariscos fuente grande");
terminal.print(" : ");
terminal.print(sg);
terminal.println("");
terminal.flush();
val22=sg*32.00;
}
uint32_t number5;
n_sm.getValue(&number5);
int sm= number5;
uint32_t dual_state5;
memset(buffer, 0, sizeof(buffer));
bsm.getValue(&dual_state5);
if(dual_state5)
{
terminal.print("Saltado de mariscos fuente mediana");
terminal.print(" : ");
terminal.print(sm);
terminal.println("");
terminal.flush();
val23=sm*25.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// OK CHICHARRONES
void envia_chPopCallback(void *ptr){
uint32_t number;
n_cpg.getValue(&number);
int cpg= number;
uint32_t dual_state;
memset(buffer, 0, sizeof(buffer));
bcpg.getValue(&dual_state);
if(dual_state)
{
terminal.print("Chicharron de pescado, fuente grande");
terminal.print(" : ");
terminal.print(cpg);
terminal.println("");
val24=cpg*30.00;
terminal.flush();
}
uint32_t number1;
n_cpm.getValue(&number1);
int cpm= number1;
uint32_t dual_state1;
memset(buffer, 0, sizeof(buffer));
bcpm.getValue(&dual_state1);
if(dual_state1)
{
terminal.print("Chicharron de pescado, fuente mediana");
terminal.print(" : ");
terminal.print(cpm);
terminal.println("");
terminal.flush();
val25=cpm*25.00;
}
uint32_t number2;
n_cplg.getValue(&number2);
int cplg= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
bcplg.getValue(&dual_state2);
if(dual_state2)
{
terminal.print("Chicharron de pulpo, fuente grande");
terminal.print(" : ");
terminal.print(cplg);
terminal.println("");
terminal.flush();
val26= cplg*35.00;
}
uint32_t number3;
n_cplm.getValue(&number3);
int cplm= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
bcplm.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("Chicharron de pulpo, fuente mediana");
terminal.print(" : ");
terminal.print(cplm);
terminal.println("");
terminal.flush();
val27=cplm*22.00;
}
uint32_t number4;
n_cmxg.getValue(&number4);
int cmxg= number4;
uint32_t dual_state4;
memset(buffer, 0, sizeof(buffer));
bcmxg.getValue(&dual_state4);
if(dual_state4)
{
terminal.print("Chicharron mixto, fuente grande");
terminal.print(" : ");
terminal.print(cmxg);
terminal.println("");
terminal.flush();
val28=cmxg*35.00;
}
uint32_t number5;
n_cmxm.getValue(&number5);
int cmxm= number5;
uint32_t dual_state5;
memset(buffer, 0, sizeof(buffer));
bcmxm.getValue(&dual_state5);
if(dual_state5)
{
terminal.print("Chicharron mixto, fuente mediana");
terminal.print(" : ");
terminal.print(cmxm);
terminal.println("");
terminal.flush();
val29=cmxm*25.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// OK JALEAS
void envia_jalPopCallback(void *ptr){
uint32_t number;
n_jpg.getValue(&number);
int jpg= number;
uint32_t dual_state;
memset(buffer, 0, sizeof(buffer));
bjpg.getValue(&dual_state);
if(dual_state)
{
terminal.print("jalea de pescado, fuente grande");
terminal.print(" : ");
terminal.print(jpg);
terminal.println("");
terminal.flush();
val30=jpg*35.00;
}
uint32_t number1;
n_jpm.getValue(&number1);
int jpm= number1;
uint32_t dual_state1;
memset(buffer, 0, sizeof(buffer));
bjpm.getValue(&dual_state1);
if(dual_state1)
{
terminal.print("jalea de pescado, fuente mediana");
terminal.print(" : ");
terminal.print(jpm);
terminal.println("");
terminal.flush();
val31=jpm*25.00;
}
uint32_t number2;
n_jmg.getValue(&number2);
int jmg= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
bjmg.getValue(&dual_state2);
if(dual_state2)
{
terminal.print("jalea de mariscos, fuente grande");
terminal.print(" : ");
terminal.print(jmg);
terminal.println("");
terminal.flush();
val32=jmg*38.00;
}
uint32_t number3;
n_jmm.getValue(&number3);
int jmm= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
bjmm.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("jalea de mariscos, fuente mediana");
terminal.print(" : ");
terminal.print(jmm);
terminal.println("");
terminal.flush();
val33=jmm*27.00;
}
uint32_t number4;
n_jmxg.getValue(&number4);
int jmxg= number4;
uint32_t dual_state4;
memset(buffer, 0, sizeof(buffer));
bjmxg.getValue(&dual_state4);
if(dual_state4)
{
terminal.print("jalea mixta, fuente grande");
terminal.print(" : ");
terminal.print(jmxg);
terminal.println("");
terminal.flush();
val34=jmxg*38.00;
}
uint32_t number5;
n_jmxm.getValue(&number5);
int jmxm= number5;
uint32_t dual_state5;
memset(buffer, 0, sizeof(buffer));
bjmxm.getValue(&dual_state5);
if(dual_state5)
{
terminal.print("jalea mixta, fuente mediana");
terminal.print(" : ");
terminal.print(jmxm);
terminal.println("");
terminal.flush();
val35=jmxm*28.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// OK GASEOSA
void ok_gasPopCallback(void *ptr){
uint32_t number;
n_ing.getValue(&number);
int ing=number;
uint32_t inka;
memset(buffer, 0, sizeof(buffer));
bting.getValue(&inka);
if(inka){
terminal.print("Inka cola grande");
terminal.print(" : ");
terminal.print(ing);
terminal.println("");
terminal.flush();
val36=ing*6.00;
}
uint32_t number2;
n_inp.getValue(&number2);
int inp= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
btinp.getValue(&dual_state2);
if(dual_state2){
terminal.print("Inka cola personal");
terminal.print(" : ");
terminal.print(inp);
terminal.println("");
terminal.flush();
val37=inp*1.50;
}
uint32_t number3;
n_cog.getValue(&number3);
int cog= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
btcog.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("Coca cola grande");
terminal.print(" : ");
terminal.print(cog);
terminal.println("");
terminal.flush();
val38=cog*6.50;
}
uint32_t number4;
n_cop.getValue(&number4);
int cop= number4;
uint32_t dual_state4;
memset(buffer, 0, sizeof(buffer));
btcop.getValue(&dual_state4);
if(dual_state4)
{
terminal.print("Coca cola personal");
terminal.print(" : ");
terminal.print(cop);
terminal.println("");
terminal.flush();
val39=cop*2.00;
}
uint32_t number5;
n_peg.getValue(&number5);
int peg= number5;
uint32_t dual_state5;
memset(buffer, 0, sizeof(buffer));
btpeg.getValue(&dual_state5);
if(dual_state5)
{
terminal.print("Pepsi cola grande");
terminal.print(" : ");
terminal.print(peg);
terminal.println("");
terminal.flush();
val40=peg*6.50;
}
uint32_t number6;
n_pep.getValue(&number6);
int pep= number6;
uint32_t dual_state6;
memset(buffer, 0, sizeof(buffer));
btpep.getValue(&dual_state6);
if(dual_state6)
{
terminal.print("Pepsi cola personal");
terminal.print(" : ");
terminal.print(pep);
terminal.println("");
terminal.flush();
val41=pep*1.50;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// OK CERVEZA
void ok_cerPopCallback(void *ptr){
uint32_t number;
n_cuz.getValue(&number);
int cuz= number;
uint32_t dual_state;
memset(buffer, 0, sizeof(buffer));
btcuz.getValue(&dual_state);
if(dual_state)
{
terminal.print("Cerveza Cuzquena");
terminal.print(" : ");
terminal.print(cuz);
terminal.println("");
terminal.flush();
val42=cuz*6.5;
}
uint32_t number1;
n_cris.getValue(&number1);
int cris= number1;
uint32_t dual_state1;
memset(buffer, 0, sizeof(buffer));
btcris.getValue(&dual_state1);
if(dual_state1)
{
terminal.print("Cerveza Cristal");
terminal.print(" : ");
terminal.print(cris);
terminal.println("");
terminal.flush();
val43=cris*6.00;
}
uint32_t number2;
n_pil.getValue(&number2);
int pil= number2;
uint32_t dual_state2;
memset(buffer, 0, sizeof(buffer));
btpil.getValue(&dual_state2);
if(dual_state2)
{
terminal.print("Cerveza Pilsen");
terminal.print(" : ");
terminal.print(pil);
terminal.println("");
terminal.flush();
val44=pil*5.50;
}
uint32_t number3;
n_ne.getValue(&number3);
int neg= number3;
uint32_t dual_state3;
memset(buffer, 0, sizeof(buffer));
btne.getValue(&dual_state3);
if(dual_state3)
{
terminal.print("Cerveza Negra");
terminal.print(" : ");
terminal.print(neg);
terminal.println("");
terminal.flush();
val45=neg*6.00;
}
digitalWrite(buzz,1);
delay(50);
digitalWrite(buzz,0);
page0.show();
delay(100);
}
// OK PRINCIPAL
void ok_mainPopCallback(void *ptr){
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + "/" + month() + "/" + year();
digitalWrite(buzz,1);
digitalWrite(led,0);
delay(50);
digitalWrite(buzz,0);
digitalWrite(led,1);
conta++;
res=val+val1+val2+val3+val4+val5+val6+val7+val8+val9+val10+val11+val12+val13+val14+val15+val16+val17+val18+val20+val21+val22+val23+val24+val25+val26+val27+val28+val29+val30+val31+val32+val33+val34+val35+val36+val37+val38+val39+val40+val41+val42+val43+val44+val45;
uint32_t mesa;
n_mesa.getValue(&mesa);
int mesas= mesa;
terminal.print("Mesa Nro: ");
terminal.println(mesas);
terminal.print("Pedido Nro: 000");
terminal.println(conta);
terminal.print("Total a pagar: S/.");
terminal.println(res);
terminal.print("Hora del pedido: ");
terminal.print(currentTime);
terminal.print(" hrs del ");
terminal.print(currentDate);
terminal.println("");
terminal.println("");
terminal.flush();
total= total+res;
res=0;
val=0;
val1=0;
val2=0;
val3=0;
val4=0;
val5=0;
val6=0;
val7=0;
val8=0;
val9=0;
val10=0;
val11=0;
val12=0;
val13=0;
val14=0;
val15=0;
val16=0;
val17=0;
val18=0;
val19=0;
val20=0;
val21=0;
val22=0;
val23=0;
val24=0;
val25=0;
val26=0;
val27=0;
val28=0;
val29=0;
val30=0;
val31=0;
val32=0;
val33=0;
val34=0;
val35=0;
val36=0;
val37=0;
val38=0;
val39=0;
val40=0;
val41=0;
val42=0;
val43=0;
val44=0;
val45=0;
}
void setup(void)
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(buzz,OUTPUT);
pinMode(led,OUTPUT);
nexInit();
ok_main.attachPop(ok_mainPopCallback);
ok_cevi.attachPop(ok_ceviPopCallback);
ok_sud.attachPop(ok_sudPopCallback);
ok_mar.attachPop(ok_marPopCallback);
envia_ch.attachPop(envia_chPopCallback);
envia_jal.attachPop(envia_jalPopCallback);
ok_gas.attachPop(ok_gasPopCallback);
ok_cer.attachPop(ok_cerPopCallback);
timer.setInterval(1000L,cash);
digitalWrite(buzz,0);
digitalWrite(led,1);
Blynk.virtualWrite(V1,0);
Blynk.virtualWrite(V2,0);
Blynk.virtualWrite(V3,0);
while (Blynk.connect() == false) {
}
rtc.begin();
terminal.println(F("update" BLYNK_VERSION ": dispositivo listo"));
terminal.println("-------------------------------------------");
terminal.flush();
}
BLYNK_WRITE(V1) {
cod1=param.asInt();
}
BLYNK_WRITE(V2) {
cod2=param.asInt();
}
BLYNK_WRITE(V3) {
cod3=param.asInt();
}
void cash(){
if (cod1==15&&cod2==50&&cod3==84){
Blynk.virtualWrite(V4, total);
}else{
Blynk.virtualWrite(V4,"0");
}
}
void loop(void)
{
Blynk.run();
timer.run();
nexLoop(nex_listen_list);
}
```