1

I've tried to create a receiver code for receiving my data (really only want the ac/gy values and nothing else) and use the following main code for sending via C programming: https://github.com/YifanJiangPolyU/MPU6050/blob/master/main.c

the sending receiving code in Arduino this far is the following (that doesn't work):

void do_send(osjob_t* j){
    // Check if there is not a current TX/RX job running
    if (LMIC.opmode & OP_TXRXPEND) {
        Serial.println(F("OP_TXRXPEND, not sending"));
    } else {
        // Prepare upstream data transmission at the next possible time.
        
byte strArray[30];
    int i = 0;
    if(Serial1.available()>0) {    
       while (Serial1.available()>0){
          strArray[i] = Serial1.read();
          i++;
       }
            // send the 6 bytes payload to LoRaWAN port 7 --> now port 1
            LMIC_setTxData2(1, strArray, sizeof(strArray), 1); //might need to be converted to type data, not char.
            
            digitalWrite(LED_BUILTIN, HIGH);    // turn the LED on by making the voltage HIGH                      //optional: for confirmation
    }
        }
    }
    // Next TX is scheduled after TX_COMPLETE event.
    //delay(60000);

I've noticed that I cannot send char arrays with LMIC function for the feather m0, so I tried receiving it as a byte array which works to send. Any help/suggestions/snippets of code etc. would be greatly appreciated.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.