Month: June 2021
node-red-contrib-webhookrelay (node) – Node-RED
Problem with MQTT retain?
Retained Messages – MQTT Essentials: Part 8
Example of interrupt-based version of reading serial port – Using Arduino
Amundsen (2019)
Waiting for AT COMMAND correct response – Using Arduino
int16_t wait(char* Values, uint16_t timeout) {
uint16_t Length = strlen(Values);
char InputBuffer[Length + 1];
strcpy(InputBuffer, Values);
char CompareBuffer[Length + 1];
memset(CompareBuffer,0,sizeof(CompareBuffer));
uint16_t Quantity = 1;
for (int16_t n = 0; n < Length; n++) {
if (InputBuffer[n] == ‘,’)
Quantity++;
}
char* InputTokens[Quantity];
memset(InputTokens, 0, sizeof(InputTokens));
char* CompareTokens[Quantity];
memset(CompareTokens, 0, sizeof(CompareTokens));
InputTokens[0] = InputBuffer;
CompareTokens[0] = CompareBuffer;
uint16_t TokenPosition = 1;
for (int16_t n = 0; n < Length; n++) {
if (InputBuffer[n] == ‘,’) {
InputBuffer[n] = 0;
InputTokens[TokenPosition] = &InputBuffer[n + 1];
CompareTokens[TokenPosition] = &CompareBuffer[n + 1];
TokenPosition++;
}
}
uint64_t timer = millis();
char c;
while (millis() – timer < timeout) {
while (mySerial.available()) {
c = mySerial.read();
Serial.print(c);
for (int16_t n = 0; n < Quantity; n++) {
Length = strlen(CompareTokens[n]);
if (c == InputTokens[n][Length])
CompareTokens[n][Length] = c;
else
memset(CompareTokens[n], 0, Length);
if (!strcmp(InputTokens[n],CompareTokens[n]))
return n;
}
}
}
return -1;
}
Source: Waiting for AT COMMAND correct response – Using Arduino / Programming Questions – Arduino Forum
SIM7020C NB-IoT MQTT communication Raspberry Pi 4B – Programmer Sought
The above is an example of Weixue. In my case, the second and fourth items need to be changed
AT+CMQCON=0,3,”myclient”,6000,0,0,”admin”,”password” You need to add admin and password. If you don’t add it, you cannot connect.
Source: SIM7020C NB-IoT MQTT communication Raspberry Pi 4B – Programmer Sought