Buen día,
He avanzado un poco con la programación del hmi desde mi pregunta en el canal de youtube, sin embargo aún no puedo conseguir que un botón físico, accione o simule la acción de presionar el botón en la pantalla de nextion;en cuanto a la programación del arduino tengo una pequeña parte.
Creo que es importante entender el proyecto, que se ha hecho, me refiero a que lo he logrado hacer pero con matrices led 8x8, y que quiero lograr.
Este proyecto monitorea el tiempo en que una persona debe ensamblar una parte de un producto, y cuanto tiempo se excede esa persona en hacer su operación.
La máquina recibe un pallet, el PLC de esa máquina me envía una señal en alto hasta que el pallet deja la estación, esta señal es monitoreada por el arduino.
El programa que tengo funcionando con las matrices funciona a la perfección, y funciona de la siguiente manera:
Se tiene compara el tiempo en que la señal está en alto, si esta señal es mayor a 40 segundos, empiezo a contar y desplegar un cronómetro acumulativo en una display de 4 matrices led 8x8.
cuando la señal cambia a cero el cronómetro se detiene,
En un segundo display, despliego el conteo descendente de 40 seg a cero en cuanto es detectada la señal en alto. si nunca llega un pallet a la estación el segundo display se queda en 40 seg, y el cronometro acumulativo no suma tiempo, ya que monitoreamos el tiempo de la operación del trabajador no monitoreamos si hay o no pallet en dicha estación.
anexo los codigos de arduino. El primero es el contador acumulativo, el segundo es el contador descendente.
#include <MaxMatrix.h>
#include <String.h>
#include <avr/pgmspace.h>
PROGMEM unsigned char const CH[] = {
1, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
4, 8, B00000000, B01000010, B01111111, B01000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
3, 8, B00000000, B00100100, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
};
int data = 11; // DIN pin del modulo MAX7219
int load = 12; // CS pin del modulo MAX7219
int clk = 13; // CLK pin del modulo MAX7219
int maxInUse = 4; //Cambie este valor dependiendo del numero de matrices que use
MaxMatrix m(data, load, clk, maxInUse); // Define el modulo
byte buffer[10];
unsigned long tiempo0 = 30000; // tiempo que debe estar pulsado el boton en milisegundos (segundos * 1000)
unsigned long tiempo1 = 0;
unsigned long tiempo2 = 0;
unsigned long tiempo3 = 0;
unsigned long tiempo4 = 0;
unsigned long tiempo5 = 0;
unsigned long tiempo6 = 0;
unsigned long unidades = 0;
unsigned long decenas = 0;
unsigned long centenas = 0;
unsigned long unidadesdemiles = 0;
unsigned long decenasdemiles = 0;
unsigned long segundos = 0;
unsigned long minutos = 0;
unsigned long cronometro = 0;
char cadena1[]="";
String despliegue;
const int buttonPin = 3; //ENTRADA DEL SENSOR
int buttonState = 0;
int cnt=0;
int LV = 11; //SALIDA DE LA LAMPARA
void setup() {
Serial.begin(9600);
tiempo1 = millis();
pinMode(buttonPin, INPUT);
pinMode(LV, OUTPUT);
m.init(); // inicializa el modulo
m.setIntensity(2); // intencidad de los puntos de la matriz, entre 1-5
}
void loop() {
buttonState = digitalRead(buttonPin);
tiempo1 = millis();
tiempo5=tiempo5+tiempo4;
tiempo4=0;
cronometro=tiempo5/1000;
digitalWrite(LV, LOW);
if (buttonState==LOW){ //HIGH para blocked y LOW para starving
while(buttonState == LOW) {
tiempo2=millis();
buttonState = digitalRead(buttonPin);
tiempo3=tiempo2-tiempo1;
if (tiempo3>=tiempo0){
tiempo4=tiempo3-tiempo0;
tiempo6=(tiempo4/1000)+cronometro;
// variables arduino variables nextion
segundos=tiempo6%60; //sec
minutos=(tiempo6/60); //min
unidades=segundos%10; //unidades
decenas=segundos/10; //decenas
centenas=minutos%10; //centenas
unidadesdemiles=(minutos%100)/10; //unimiles
decenasdemiles=minutos/100; //decmiles
digitalWrite(LV, HIGH);
despliegue= " " + String(decenasdemiles) + String(unidadesdemiles) + String(centenas) + ":" + String(decenas) + String(unidades);
despliegue.toCharArray(cadena1,
;
printString(cadena1,10);
// Serial.println(cadena1);
}
}
}
}
void printString(char* s, int shift_speed) {
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}
__________________________________________________________________________________________________
#include <MaxMatrix.h>
#include <String.h>
#include <avr/pgmspace.h>
PROGMEM unsigned char const CH[] = {
1, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
4, 8, B00000000, B01000010, B01111111, B01000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
3, 8, B00000000, B00100100, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
};
int data = 8; // DIN pin del modulo MAX7219 8DIN 9CS 10CLK
int load = 9; // CS pin del modulo MAX7219
int clk = 10; // CLK pin del modulo MAX7219
int maxInUse = 4; //Cambie este valor dependiendo del numero de matrices que use
MaxMatrix m(data, load, clk, maxInUse); // Define el modulo
byte buffer[10];
unsigned long tiempo0 = 20000; // tiempo en milisegundos (segundos * 1000) para lampara roja y cronometro 25seg en adelante
unsigned long tiempo7 = 19500; // tiempo en milisegundos (segundos * 1000) para lampara amarilla 25seg
unsigned long tiempo1 = 0;
unsigned long tiempo2 = 0;
unsigned long tiempo3 = 0;
unsigned long tiempo4 = 0;
unsigned long tiempo5 = 0;
unsigned long tiempo6 = 0;
unsigned long unidades = 0;
unsigned long decenas = 0;
unsigned long centenas = 0;
unsigned long unidadesdemiles = 0;
unsigned long decenasdemiles = 0;
unsigned long segundos = 0;
unsigned long minutos = 0;
unsigned long cronometro = 0;
char cadena1[]="";
String despliegue;
const int buttonPin = 2; //ENTRADA DEL SENSOR ARDUINO UNO IN3
int buttonState = 0;
int cnt=0;
int LR = 11; //SALIDA DE LA LAMPARA VERDE 49 LAMPARAS ARDUINO UNO LV12 LR11
//int LA = 51; //SALIDA DE LA LAMPARA AMARILLA
int LV = 13; //SALIDA DE LA LAMPARA ROJA53
void setup() {
Serial.begin(9600);
tiempo1 = millis();
pinMode(buttonPin, INPUT);
pinMode(LV, OUTPUT);
// pinMode(LA, OUTPUT);
pinMode(LR, OUTPUT);
m.init(); // inicializa el modulo
m.setIntensity(2); // intencidad de los puntos de la matriz, entre 1-5
}
void loop() {
buttonState = digitalRead(buttonPin);
tiempo1 = millis();
tiempo5=tiempo5+tiempo4;
tiempo4=0;
cronometro=tiempo5/1000;
digitalWrite(LV, HIGH);
//digitalWrite(LA, HIGH);
digitalWrite(LR, LOW);
if (buttonState==LOW){ //HIGH ES PARA BLOQUEADO LOW ES PARA SIN PALLET
while(buttonState ==LOW ) {
tiempo2=millis();
buttonState = digitalRead(buttonPin);
tiempo3=tiempo2-tiempo1;
if (tiempo3>=tiempo7 && tiempo3<=tiempo0){
digitalWrite(LV, LOW);
// digitalWrite(LA, LOW);
digitalWrite(LR, HIGH);
}
if (tiempo3>tiempo0){
tiempo4=tiempo3-tiempo0;
tiempo6=(tiempo4/1000)+cronometro;
segundos=tiempo6%60;
minutos=(tiempo6/60);
unidades=segundos%10;
decenas=segundos/10;
centenas=minutos%10;
unidadesdemiles=(minutos%100)/10;
decenasdemiles=minutos/100;
digitalWrite(LV, LOW);
//digitalWrite(LA, HIGH);
digitalWrite(LR, HIGH);
despliegue= " " + String(decenasdemiles) + String(unidadesdemiles) + String(centenas) + ":" + String(decenas) + String(unidades);
despliegue.toCharArray(cadena1,
;
printString(cadena1,10);
Serial.println(cadena1);
}
}
}
}
void printString(char* s, int shift_speed) {
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7 * c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}
//
Hasta este punto todo va bien. Me pidieron actualizar a pantalla Nextion debido a que debo mostrar los dos tiempos, el acumulado y el que contador descendente. Además de poder cambiar el tiempo en el que se deben ensamblar las piezas.
lo que tengo es lo siguiente: anexo archivo .tft, el archivo HMI la pantalla que estoy usando es el modelo Basic. NX4827T043_011
y el código en arduino es el siguiente:
#include "Nextion.h"
#include "NexButton.h"
NexButton b0 = NexButton(0, 18, "b0");
NexNumber n0 = NexNumber(0, 6, "n0");
NexNumber n6 = NexNumber(0, 20, "n6");
NexText t7 = NexText(0,17,"t7");
int cuenta = 0;
const int buttonPin = 52;
int buttonState = 0;
const int buttonPin2 = 50;
int buttonState2 = 0;
const int led=13;
NexTouch *nex_listen_list[] =
{
&b0,
NULL
};
void cambiarLED(void *ptr) {
digitalWrite(led, !digitalRead(led));
}
void setup() {
nexInit();
b0.attachPop(cambiarLED, &b0);
pinMode(led, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
nexLoop(nex_listen_list);
buttonState = (digitalRead(buttonPin));
buttonState2 = (digitalRead(buttonPin2));
if (buttonState == HIGH) {
cuenta++;
t7.setText("hola mundo");
n6.setValue( 0x65 ); //65 00 12 01 FF FF FF // quiero ver que manda a la pantalla y se despliega un número decimal 101
//n0.setValue(cuenta);
}
if (buttonState2 == LOW) {
cuenta--;
t7.setText("adios mundo");
}
n0.setValue(cuenta);
delay(100);
}
Qué es lo que requiero hacer?
es presionar un botón o leer una entrada del arduino y simular que presiono la pantalla hmi el b0 para poder iniciar mi conteo, SENCILLO tal vez pero no logro hacerlo, agradecería la ayuda de la comunidad para lograrlo.
muchas gracias