Today I have an im880A node from IMST and I am wanting to transmit the measurements of a distance sensor.
I am not succeeding in my code.
I can send hello world but I do not send the sensor data.
Can I borrow some please?
Below is a part of the code and its error.
The error:
initializer fails to determine size of ā__cā
Part of my code
for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through each sensor and display results.
delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
unsigned long value = sonar[i].ping_cm();
String stringValue = "";
char charValue[5];
stringValue += value;
strcpy(charValue, stringValue.c_str());
// send out a hello world every 30 sec ( =6* 50*100 ms)
// (due to duty cycle restrictions 30 sec is recommended
if ((loopCnt > 1) && (loopCnt % (6 * 50)) == 0) {
// send out a simple HelloWorld messsage
debugMsg(F("Sending HelloWorld message...\n"));
// prepare TX data structure
txData.Port = 0x01;
txData.Length = sonar[i].ping_cm();
strcpy_P((const char*) txData.Payload, PSTR(charValue));
void loop()
{
// check of OTAA procedure has finished
if (RIB.ModemState == ModemState_Connected) {
// send out a hello world every 30 sec ( =6* 50*100 ms)
// (due to duty cycle restrictions 30 sec is recommended
if ((loopCnt > 1) && (loopCnt % (6 * 50)) == 0) {
// send out a simple HelloWorld messsage
debugMsg(F("Sending HelloWorld message...\n"));
for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through each sensor and display results.
delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
unsigned long value = sonar[i].ping_cm();
String stringValue = "";
stringValue += value;
char charValue[5];
stringValue += value;
strcpy(charValue, stringValue.c_str());
// prepare TX data structure
txData.Port = 0x01;
txData.Length = sonar[i].ping_cm();
strcpy_P((char*) txData.Payload, charValue);
My Payload Function
function Decoder(bytes, port) {
// Decode plain text; for testing only
if
(bytes[2] === 0)
return {
cm: String.fromCharCode.apply (null, bytes.slice(0, 2))
};
else
return {
cm: String.fromCharCode.apply (null, bytes.slice(0, 3))
};
}