Site icon Renzo Mischianti

Go to sleep after sending data – safeguarding

Hi, I realised that if you use the commands:
ResponseStatus rs = e220ttl.sendMessage(&struct1, sizeof(struct1));
Serial.print(rs.getResponseDescription()); 
and even if the outcome is "Success" it does NOT mean the message was sent. The only way to make sure transmission is finished is to observe AUX input - it takes around 360ms and (probably) it depends on the amount of data to be sent:
#define AUX xx
pinMode(AUX,INPUT);
while (digitalRead(AUX) == 0) {}
and once it is LOW, you can safely send E220 to sleep, i.e. this way:
#define M0    19
#define M1    21
pinMode(M0, OUTPUT);
pinMode(M1, OUTPUT);
digitalWrite(M0, 1);
digitalWrite(M1, 1);
Exit mobile version