Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Capteur autonome Penn Avel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pronto 3
Capteur autonome Penn Avel
Commits
8318fff7
Commit
8318fff7
authored
1 month ago
by
CARNEIRO--GILLET Alexandre
Browse files
Options
Downloads
Patches
Plain Diff
ajout test_recept_loramac, jsp si ça marche
parent
6767d33b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GW-custom/test_envoi_senscom.py
+2
-0
2 additions, 0 deletions
GW-custom/test_envoi_senscom.py
GW-custom/test_recept_loramac.py
+47
-0
47 additions, 0 deletions
GW-custom/test_recept_loramac.py
with
49 additions
and
0 deletions
GW-custom/test_envoi_senscom.py
+
2
−
0
View file @
8318fff7
...
@@ -2,6 +2,8 @@ import json
...
@@ -2,6 +2,8 @@ import json
import
requests
import
requests
## Envoi des données sur sensor community
url
=
"
https://api.sensor.community/v1/push-sensor-data/
"
url
=
"
https://api.sensor.community/v1/push-sensor-data/
"
headers
=
{
headers
=
{
"
Content-Type
"
:
"
application/json
"
,
"
Content-Type
"
:
"
application/json
"
,
...
...
This diff is collapsed.
Click to expand it.
GW-custom/test_recept_loramac.py
0 → 100644
+
47
−
0
View file @
8318fff7
import
time
from
machine
import
UART
,
Pin
# Configuration UART pour le module LoRa E5
uart
=
UART
(
1
,
baudrate
=
9600
,
tx
=
17
,
rx
=
16
)
# Configuration de la broche pour le module LoRa E5
reset_pin
=
Pin
(
18
,
Pin
.
OUT
)
reset_pin
.
value
(
1
)
def
reset_lora
():
reset_pin
.
value
(
0
)
time
.
sleep
(
0.1
)
reset_pin
.
value
(
1
)
time
.
sleep
(
0.1
)
def
send_command
(
command
,
delay
=
0.5
):
uart
.
write
(
command
+
'
\r\n
'
)
time
.
sleep
(
delay
)
response
=
uart
.
read
()
if
response
:
print
(
response
.
decode
(
'
utf-8
'
))
def
setup_lora
():
reset_lora
()
send_command
(
'
AT+MODE=LWOTAA
'
)
send_command
(
'
AT+DR=EU868
'
)
send_command
(
'
AT+KEY=APPKEY,
"
YOUR_APP_KEY
"'
)
send_command
(
'
AT+ID=DevAddr,
"
YOUR_DEV_ADDR
"'
)
send_command
(
'
AT+ID=DevEui,
"
YOUR_DEV_EUI
"'
)
send_command
(
'
AT+ID=AppEui,
"
YOUR_APP_EUI
"'
)
send_command
(
'
AT+JOIN
'
)
def
receive_lora
():
while
True
:
if
uart
.
any
():
response
=
uart
.
read
()
if
response
:
print
(
"
Received:
"
,
response
.
decode
(
'
utf-8
'
))
time
.
sleep
(
1
)
# Initialisation du module LoRa
setup_lora
()
# Boucle de réception des messages
receive_lora
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment