Hirdetés

Keresés

Új hozzászólás Aktív témák

  • olli

    tag

    válasz vargalex #20460 üzenetére

    "Received packet :1 HELLO 36.75 22.50 32342' with RSSI -82"
    Jelenleg így íratom ki a csomagot, de csak az első karakterét, a state értékét is külön kellene megkapnom.
    Szerinted hogyan nézzen ki a kód?
    #include <SPI.h>
    #include <LoRa.h>
    unsigned int state;
    //LoRa32u4 ports
    #define SS 8
    #define RST 4
    #define DI0     7
    #define BAND    433E6void
    setup() {  Serial.begin(115200);   
    pinMode(13, OUTPUT);    // fehér led sets the pin as output for relay 
    digitalWrite(13,HIGH); 
    //while (!Serial);        //if just the the basic function, must connect to a computer 
    delay(1000);    
    SPI.begin(); 
    LoRa.setPins(SS,RST,DI0); 
    Serial.println("LoRa Receiver");   
    if (!LoRa.begin(433E6)) {   
    Serial.println("Starting LoRa failed!");   
    while (1);  } 
    Serial.println("LoRa Initial OK!");}
     /*----( LOOP: RUNS CONSTANTLY )----*/
    void loop() {   
    digitalWrite(13,LOW);     // try to parse packet 
    int packetSize = LoRa.parsePacket(); 
    if (packetSize) {  // received a packet   
    Serial.print("Received packet :");  // read packet   
    while (LoRa.available()) {     
    Serial.print((char)LoRa.read());  }      
    // print RSSI of packet   
    Serial.print("' with RSSI ");   
    Serial.println(LoRa.packetRssi());}}

Új hozzászólás Aktív témák