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
09312c50
Commit
09312c50
authored
3 weeks ago
by
CARNEIRO--GILLET Alexandre
Browse files
Options
Downloads
Patches
Plain Diff
modifs non commit de la dernière fois
parent
40b1a8b1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Autre/pygate 2/main.py
+7
-4
7 additions, 4 deletions
Autre/pygate 2/main.py
GW-custom/LoRa_homemade/main.py
+3
-20
3 additions, 20 deletions
GW-custom/LoRa_homemade/main.py
with
10 additions
and
24 deletions
Autre/pygate 2/main.py
+
7
−
4
View file @
09312c50
from
network
import
WLAN
import
time
import
machine
from
machine
import
RTC
import
pycom
from
machine
import
RTC
from
network
import
WLAN
print
(
'
\n
Starting LoRaWAN concentrator
'
)
# Disable Hearbeat
...
...
@@ -27,12 +28,14 @@ machine.callback(trigger = (machine.PYGATE_START_EVT | machine.PYGATE_STOP_EVT |
print
(
'
Connecting to WiFi...
'
,
end
=
''
)
# Connect to a Wifi Network
wlan
=
WLAN
(
mode
=
WLAN
.
STA
)
wlan
.
connect
(
ssid
=
'
ObjetsConnectes
'
,
auth
=
(
WLAN
.
WPA2
,
'
Pandemie2021
'
))
wlan
.
connect
(
ssid
=
'
Redmi Note 8 (2021)
'
,
auth
=
(
WLAN
.
WPA2
,
'
lemotdepassecestca
'
))
#wlan.connect(ssid='iPhone de Charlotte', auth=(WLAN.WPA2, 'azilisenoraalan'))
while
not
wlan
.
isconnected
():
timout
=
10
# seconds
while
not
wlan
.
isconnected
()
and
timout
>
0
:
print
(
'
.
'
,
end
=
''
)
time
.
sleep
(
1
)
timout
-=
1
print
(
"
OK
"
)
# Sync time via NTP server for GW timestamps on Events
...
...
This diff is collapsed.
Click to expand it.
GW-custom/LoRa_homemade/main.py
+
3
−
20
View file @
09312c50
...
...
@@ -49,7 +49,7 @@ def blink_led(times, interval):
led
.
value
(
0
)
# Eteindre la LED
time
.
sleep
(
interval
)
# Attendre un certain temps
def
configure_lora
(
frequency
,
sf
,
bw
,
TXPR
,
RXPR
,
TX_power
):
def
configure_lora
():
send_at_command
(
""
)
send_at_command
(
"
+MODE=TEST
"
)
...
...
@@ -90,7 +90,7 @@ def send_to_sensor_community_sht30(temp, humid):
url
=
"
https://api.sensor.community/v1/push-sensor-data/
"
headers
=
{
"
Content-Type
"
:
"
application/json
"
,
"
X-Pin
"
:
"
7
"
,
# 7 = SHT30
"
X-Pin
"
:
"
7
"
,
# 7 = SHT30
ou DHT22
"
X-Sensor
"
:
"
esp32-900881266
"
}
data
=
{
...
...
@@ -129,23 +129,6 @@ def try_receive():
wifi_connect
()
# Connexion au Wi-Fi
wlan
=
network
.
WLAN
(
network
.
STA_IF
)
print
(
wlan
.
ifconfig
())
import
urequests
try
:
r
=
urequests
.
post
(
"
http://httpbin.org/post
"
,
json
=
{
"
test
"
:
123
})
print
(
"
Réponse HTTP:
"
,
r
.
status_code
)
print
(
r
.
text
)
r
.
close
()
except
Exception
as
e
:
print
(
"
Erreur:
"
,
e
)
uart
=
UART
(
2
,
baudrate
=
9600
,
tx
=
17
,
rx
=
16
)
...
...
@@ -154,7 +137,7 @@ led = Pin(2, Pin.OUT) # GPIO 2 pour la LED bleue intégrée
# Initialisation du module LoRa
blink_led
(
3
,
0.5
)
# Clignoter la LED 3 fois au démarrage
print
(
"
\n\n
Initialisation du module LoRa-E5...
\n
"
)
configure_lora
(
868000000
,
12
,
125
,
12
,
15
,
14
)
# Configurer le module LoRa avec les paramètres souhaités
configure_lora
()
# Configurer le module LoRa avec les paramètres souhaités
send_at_command
(
"
+TEST=RXLRPKT
"
)
# Commencer la réception des paquets LoRa
led
.
value
(
1
)
# Rallumer la LED après l'initialisation
...
...
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