Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS437 Final Project
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
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
bcorn2
CS437 Final Project
Commits
af32d214
Commit
af32d214
authored
3 years ago
by
Ben Corn
Browse files
Options
Downloads
Patches
Plain Diff
Add arduino code for soil moisture
parent
997e2ed7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
soil_moisture.ino
+27
-0
27 additions, 0 deletions
soil_moisture.ino
with
27 additions
and
0 deletions
soil_moisture.ino
0 → 100644
+
27
−
0
View file @
af32d214
const
int
AirValue
=
683
;
//you need to replace this value with Value_1
const
int
WaterValue
=
260
;
//you need to replace this value with Value_2
int
soilMoistureValue
=
0
;
int
soilmoisturepercent
=
0
;
void
setup
()
{
Serial
.
begin
(
9600
);
// open serial port, set the baud rate to 9600 bps
}
void
loop
()
{
soilMoistureValue
=
analogRead
(
A0
);
//put Sensor insert into soil
//Serial.println(soilMoistureValue);
soilmoisturepercent
=
map
(
soilMoistureValue
,
AirValue
,
WaterValue
,
0
,
100
);
if
(
soilmoisturepercent
>=
100
)
{
Serial
.
println
(
"100 %"
);
}
else
if
(
soilmoisturepercent
<=
0
)
{
Serial
.
println
(
"0 %"
);
}
else
if
(
soilmoisturepercent
>
0
&&
soilmoisturepercent
<
100
)
{
Serial
.
print
(
soilmoisturepercent
);
Serial
.
println
(
"%"
);
}
delay
(
250
);
}
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