Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with onHMIEvent #18

Open
Arvinth-Krishna opened this issue Mar 27, 2024 · 1 comment
Open

Issue with onHMIEvent #18

Arvinth-Krishna opened this issue Mar 27, 2024 · 1 comment

Comments

@Arvinth-Krishna
Copy link

OnEvent : [ A : 6500 | D : 0 | M : | R : 5a a5 83 65 00 01 00 00 ]
OnEvent : [ A : 6500 | D : 1 | M : | R : 5a a5 83 65 00 01 00 01 ]
OnEvent : [ A : 6500 | D : 0 | M : | R : 5a a5 83 65 00 01 00 00 ]
OnEvent : [ A : 6500 | D : 1 | M : | R : 5a a5 83 65 00 01 00 01 ]
OnEvent : [ A : 6500ffff | D : ffffffff | M : | R : 5a a5 83 65 00 01 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ]
OnEvent : [ A : 6500 | D : 1 | M : | R : 5a a5 83 65 00 01 00 01 ]
OnEvent : [ A : ffff6500 | D : 0 | M : ⸮ | R : ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 5a a5 83 65 00 01 00 00 ]

May I know how to fix this issue? why it's happening like this?

@Arvinth-Krishna
Copy link
Author

This is the code Im using:

#include <Arduino.h>
#include <DWIN.h>
#include <SPI.h>
#include <Wire.h>

#define DGUS_BAUD 115200

#define DGUS_SERIAL Serial2
DWIN hmi(DGUS_SERIAL, 16, 17, DGUS_BAUD);

#define temperature_add 0x61

unsigned char Temperature[8] = {0x5a, 0xa5, 0x05, 0x82, temperature_add, 0x00, 0x00, 0x00};

// Event Occurs when response comes from HMI
void onHMIEvent(String address, int lastByte, String message, String response){
Serial.println("OnEvent : [ A : " + address + " | D : "+ String(lastByte, HEX)+ " | M : "+message+" | R : "+response+ " ]");
if (address == "6500"){
if(String("1")==(String(lastByte, HEX))){
digitalWrite(27,HIGH);
}else{
digitalWrite(27,LOW);
}
}
}

void setup() {
Serial.begin(115200);
Serial.println("DWIN HMI ~ Hello World");
hmi.echoEnabled(false);
hmi.hmiCallBack(onHMIEvent);
pinMode(27,OUTPUT);
digitalWrite(27,LOW);
}
int t=0;
int tf=0;

void loop() {
// Listen HMI Events
hmi.listen();

// // Write data to DWIN display
// if (tf < 998) {
// tf++;
// } else {
// tf = 0;
// }
// t = tf * 1000;

// Temperature[6] = highByte(t);
// Temperature[7] = lowByte(t);

// Serial2.write(Temperature, HEX);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant