Öne ÇıkarılanÇözüldü3.74K görüntülenmeArduinoarduino mega Lora
0

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include “LoRa_E32.h”

static const int RXPin = 11, TXPin = 10;
static const uint32_t GPSBaud = 9600;

TinyGPSPlus gps;

SoftwareSerial portgps(RXPin, TXPin);
SoftwareSerial portlora(52, 51);

LoRa_E32 e32ttl(&portlora);

typedef struct {
byte altitude[10];
byte latitude[10];
byte longtitude[10];
} Signal;
Signal data;

void setup()
{
Serial.begin(9600);
portgps.begin(GPSBaud);
delay(500);
e32ttl.begin();
delay(500);
}

void loop()
{
portgps.listen();
if (gps.location.isValid()) {
Serial.print(“Altitude: “);
*(float*)(data.altitude) = (gps.altitude.meters());
Serial.println(*(float*)data.altitude);

Serial.print(“Latitude: “);
*(float*)(data.latitude) = (gps.location.lat() ,6);
Serial.println(*(float*)data.latitude);

Serial.print(“Longitude: “);
*(float*)(data.longtitude) = (gps.location.lng(), 6);
Serial.println(*(float*)data.longtitude);
}
else
Serial.println( “error”);

smartDelay(1000);

if (millis() > 5000 && gps.charsProcessed() < 10)
Serial.println(F(“No GPS data received: check wiring”));

Serial.println();

portlora.listen();

ResponseStatus rs = e32ttl.sendFixedMessage(0, 6, 23, &data, sizeof(Signal));
Serial.println(rs.getResponseDescription());

}

static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (portgps.available())
gps.encode(portgps.read());
} while (millis() – start < ms);
}

Soru yeni cevaplara kapalıdır.
Mehmet Öne çıkarılan soru olarak işaretlendi Mayıs 24, 2022
1

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include “LoRa_E32.h”

static const int RXPin = 11, TXPin = 10;
static const uint32_t GPSBaud = 9600;

TinyGPSPlus gps;

SoftwareSerial portgps(RXPin, TXPin);
SoftwareSerial portlora(52, 51);

LoRa_E32 e32ttl(&portlora);

typedef struct {
byte altitude[10];
byte latitude[10];
byte longtitude[10];
} Signal;
Signal data;

void setup()
{
Serial.begin(9600);
portgps.begin(GPSBaud);
delay(500);
e32ttl.begin();
delay(500);
}

void loop()
{
portgps.listen();
if (gps.location.isValid()) {
Serial.print(“Altitude: “);
*(float*)(data.altitude) = (gps.altitude.meters());
Serial.println(*(float*)data.altitude);

Serial.print(“Latitude: “);
*(float*)(data.latitude) = (gps.location.lat());
Serial.println(gps.location.lat());

Serial.print(“Longitude: “);
*(float*)(data.longtitude) = (gps.location.lng());
Serial.println(gps.location.lng());
}
else
Serial.println( “error”);

smartDelay(1000);

if (millis() > 5000 && gps.charsProcessed() < 10)
Serial.println(F(“No GPS data received: check wiring”));

Serial.println();

portlora.listen();

ResponseStatus rs = e32ttl.sendFixedMessage(0, 6, 23, &data, sizeof(Signal));
Serial.println(rs.getResponseDescription());

}

static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (portgps.available())
gps.encode(portgps.read());
} while (millis() – start < ms);
}

OĞUZHAN TUNÇ Cevaplanan soru Mayıs 10, 2022
3 cevaptan 1'ini inceliyorsun, tüm cevapları görmek için buraya tıklayın.