Hi Folks,
i did a test code to send and receive - as a range test. And it worked with this code. The i soldered the hardware and nothin works and even the lora module sometimes cant initialize. On USB sender sont work. On 9V block - looks ok, but i have no serial monitor for debugging... ![]()
This is all very strange. Maybe you can spot a mistake, that i missed.
I checked volage to take care of the 3.3v for the sx1278. Even used the Nano-provided 3.3v pin in 2nd try.
/// TEST RX
#include <SPI.h>
#include <LoRa.h>
///##################///
const int unitID = 3; // Einheits-ID
///##################///
int VibPin = A2;
String inString = "";
String MyMessage = "";
bool newMessang = false;
void setup() {
pinMode(A2, OUTPUT);
delay(4000);
Serial.begin(57600);
while(!Serial);
Serial.println("Setup ready");
if(!LoRa.begin(433E6))
{
Serial.println("LoRa failed");
while(1);
}
}
void loop() {
int packetSize = LoRa.parsePacket();
if(packetSize){
while(LoRa.available()){
int inChar = LoRa.read();
inString += (char)inChar;
newMessang=true;
}
MyMessage = inString;
LoRa.packetRssi();
}
if(newMessang){
Serial.println(MyMessage);
inString="";
MyMessage="";
newMessang=false;
analogWrite(VibPin, HIGH);
delay(200);
analogWrite(VibPin, LOW);
delay(200);
}
}
/// TEST SENDER
#include <SPI.h>
#include <LoRa.h>
///##################///
const int unitID = 3; // Einheits-ID
///##################///
void setup() {
Serial.begin(57600);
while(!Serial);
Serial.println("Setup ready");
if(!LoRa.begin(433E6))
{
Serial.println("LoRa failed");
while(1);
}
}
void loop() {
String Message = "402x";
LoRa.beginPacket();
LoRa.print(Message);
LoRa.endPacket();
Serial.println("Message sent!");
delay(3000);
}
