Hello!! I tried to excite this pin without a good results..
I am receiving the same message that im sending...
This is the code that im using right now.
int wakeup = 2;
int led=3;
int boton2 = 5; //Boton wakeup
int val2;
int boton = 7;
int val;
uint8_t msg[7] = {0x89, 0x01, 0x00, 0x0A, 0x00, 0xDA, 0x83}; //Mensaje que tengo que enviar para recibir el siguiente mensaje.
uint8_t response[24]; //mensaje que quiero recibir, ha de ser este 00 01 C1 C0
void setup() {
//Ponemos el botón como entrada.
pinMode(boton, INPUT);
pinMode(boton2, INPUT);
pinMode(wakeup, OUTPUT);
pinMode(led, OUTPUT);
//Inicializamos ambos puertos serie del arduino
Serial.begin(250000); //Puerto donde va conectado el USB
Serial3.begin(250000); //Puerto 3
}
void loop() {
//WAKEUP
val2=digitalRead(boton2);
if (val2 == HIGH){
digitalWrite(wakeup,HIGH);
digitalWrite(led, HIGH);
}
else{
digitalWrite(wakeup,LOW);
digitalWrite(led, LOW);
}
//Aquí si pulsamos el botón, mandamos la secuencia msg hacia el BMS
val=digitalRead(boton); //Guardo valor actual del boton
if(val == HIGH){ //Si el valor es High
Serial3.write(msg,sizeof(msg)); // send the command
while (! Serial3.available()) ; // active wait for the first byte
size_t responseSize = Serial3.readBytes(response, sizeof response);
for (size_t i = 0; i < responseSize; i++) {
Serial.print(F("0x")); Serial.print(response[i], HEX);
Serial.write(' ');
}
Serial.println();
}
}