Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IoT_Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
robert.sharp
IoT_Project
Commits
1b4f193c
Commit
1b4f193c
authored
Jan 10, 2022
by
robert.sharp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Main.ino to fix random values bug
parent
c95d51a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Main.ino
sketch_main/Main/Main.ino
+7
-3
No files found.
sketch_main/Main/Main.ino
View file @
1b4f193c
...
@@ -54,13 +54,17 @@ static const u1_t PROGMEM APPKEY[16] = { 0xEE, 0xB3, 0xA4, 0x83, 0xBF, 0xEC, 0x0
...
@@ -54,13 +54,17 @@ static const u1_t PROGMEM APPKEY[16] = { 0xEE, 0xB3, 0xA4, 0x83, 0xBF, 0xEC, 0x0
void
os_getDevKey
(
u1_t
*
buf
)
{
memcpy_P
(
buf
,
APPKEY
,
16
);}
void
os_getDevKey
(
u1_t
*
buf
)
{
memcpy_P
(
buf
,
APPKEY
,
16
);}
static
int
mydata
=
-
1
;
static
int
mydata
=
-
1
;
uint8_t
testData
[
2
];
AirQualitySensor
sensor
(
A0
);
AirQualitySensor
sensor
(
A0
);
static
byte
payload
[
2
];
static
osjob_t
sendjob
;
static
osjob_t
sendjob
;
// Schedule TX every this many seconds (might become longer due to duty
// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
// cycle limitations).
const
unsigned
TX_INTERVAL
=
6
0
;
const
unsigned
TX_INTERVAL
=
2
0
;
// Pin mapping
// Pin mapping
const
lmic_pinmap
lmic_pins
=
{
const
lmic_pinmap
lmic_pins
=
{
...
@@ -143,7 +147,7 @@ void onEvent (ev_t ev) {
...
@@ -143,7 +147,7 @@ void onEvent (ev_t ev) {
void
do_send
(
osjob_t
*
j
){
void
do_send
(
osjob_t
*
j
){
//Update mydata to be the current value of the sensor
//Update mydata to be the current value of the sensor
mydata
=
sensor
.
getValue
();
mydata
=
sensor
.
getValue
();
testData
[
0
]
=
mydata
;
//test the sensor is working
//test the sensor is working
Serial
.
print
(
"Sensor value: "
);
Serial
.
print
(
"Sensor value: "
);
Serial
.
println
(
sensor
.
getValue
());
Serial
.
println
(
sensor
.
getValue
());
...
@@ -153,7 +157,7 @@ void do_send(osjob_t* j){
...
@@ -153,7 +157,7 @@ void do_send(osjob_t* j){
Serial
.
println
(
F
(
"OP_TXRXPEND, not sending"
));
Serial
.
println
(
F
(
"OP_TXRXPEND, not sending"
));
}
else
{
}
else
{
// Prepare upstream data transmission at the next possible time.
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2
(
1
,
mydata
,
sizeof
(
myd
ata
)
-
1
,
0
);
LMIC_setTxData2
(
1
,
testData
,
sizeof
(
testD
ata
)
-
1
,
0
);
Serial
.
println
(
F
(
"Packet queued"
));
Serial
.
println
(
F
(
"Packet queued"
));
}
}
// Next TX is scheduled after TX_COMPLETE event.
// Next TX is scheduled after TX_COMPLETE event.
...
...
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