Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Forest Monitoring
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GPSE
Promo2025
Forest Monitoring
Commits
1774739b
Commit
1774739b
authored
Apr 25, 2024
by
Brice Gossin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
24899a25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
Adafruit_LoRa_tester.ino
Raspberry/Adafruit_LoRa_tester.ino
+84
-0
No files found.
Raspberry/Adafruit_LoRa_tester.ino
0 → 100644
View file @
1774739b
// Feather9x_TX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (transmitter)
// with the RH_RF95 class. RH_RF95 class does not provide for addressing or
// reliability, so you should only use RH_RF95 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example Feather9x_RX
#include <SPI.h>
#include <RH_RF95.h>
#if defined(ADAFRUIT_FEATHER_M0) || defined(ADAFRUIT_FEATHER_M0_EXPRESS) || defined(ARDUINO_SAMD_FEATHER_M0) // Feather M0 w/Radio
#define RFM95_CS 8
#define RFM95_INT 3
#define RFM95_RST 4
#endif
// Feather M0:
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 3
// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 868.1
// Singleton instance of the radio driver
RH_RF95
rf95
(
RFM95_CS
,
RFM95_INT
);
void
setup
()
{
pinMode
(
RFM95_RST
,
OUTPUT
);
//Paramètres SPI de base
digitalWrite
(
RFM95_RST
,
HIGH
);
Serial
.
begin
(
9600
);
delay
(
100
);
Serial
.
println
(
"Feather LoRa TX Test!"
);
// manual reset
// digitalWrite(RFM95_RST, LOW);
// delay(10);
// digitalWrite(RFM95_RST, HIGH);
// delay(10);
while
(
!
rf95
.
init
())
{
Serial
.
println
(
"LoRa radio init failed"
);
Serial
.
println
(
"Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info"
);
while
(
1
);
rf95
.
setSpreadingFactor
(
12
);
}
Serial
.
println
(
"LoRa radio init OK!"
);
// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
if
(
!
rf95
.
setFrequency
(
RF95_FREQ
))
{
Serial
.
println
(
"setFrequency failed"
);
//Erreur fréquence
while
(
1
);
}
Serial
.
print
(
"Set Freq to: "
);
Serial
.
println
(
RF95_FREQ
);
//Print fréquence
// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
rf95
.
setTxPower
(
23
,
false
);
}
int16_t
packetnum
=
0
;
// packet counter, we increment per xmission
void
loop
()
{
delay
(
1000
);
// Wait 10 second between transmits, could also 'sleep' here!
Serial
.
println
(
"Transmitting..."
);
// Send a message to rf95_server
char
radiopacket
[
100
]
=
"1;96;32;34;50;10000;0.0078;0.008;0.001;1"
;
// char radiopacket[100] = "Aller paris";
Serial
.
print
(
"Sending "
);
Serial
.
println
(
radiopacket
);
radiopacket
[
99
]
=
0
;
Serial
.
println
(
"Sending..."
);
delay
(
10
);
rf95
.
send
((
uint8_t
*
)
radiopacket
,
100
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment