En utilisant une carte Adafruit Feather M0 avec radio LoRa, je veux envoyer la position GPS à un récepteur. Lorsque vous essayez de créer un paquet de données avec un horodatage ISO 8601 et lat/long valeurs GPS J'utilise le code suivant pour créer un tableau char
puis envoyez-le:Opérandes non valides de types 'const char *' et 'const char [2]' à binary 'operator +'
char radiopacket[40] = {GPS.year + "-" + GPS.month + "-" + GPS.day + "T" + GPS.hour + ":" + GPS.minute + ":" + GPS.seconds + "Z" + "," + GPS.latitude + "," + GPS.longitude};
rf95.send((uint8_t *)radiopacket, 40);
Je continue à obtenir l'erreur:
invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
Où est-ce que je me trompe?
'sprintf' est pas sûr, s'il vous plaît utilisez' snprintf', voir [ici] (https://stackoverflow.com/a/3662918/2666212) – Mike
Merci ! Cela a fonctionné –