Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arduino-block-course
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Gehr
arduino-block-course
Commits
7c3571e0
Commit
7c3571e0
authored
Oct 13, 2022
by
Mario Engelmann
Browse files
Options
Downloads
Patches
Plain Diff
comments
parent
4abf1c75
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
solarpump/solarpump.ino
+24
-0
24 additions, 0 deletions
solarpump/solarpump.ino
solarpump/temperature.ino
+0
-1
0 additions, 1 deletion
solarpump/temperature.ino
with
24 additions
and
1 deletion
solarpump/solarpump.ino
+
24
−
0
View file @
7c3571e0
...
...
@@ -46,6 +46,11 @@ void controlPump(uint8_t pumpPin, float tempUp, float tempDown) {
}
}
/*
* prints a float where the decimals specify the numbers of digit, which are printed,
* after the decimal point and
* rightPad specifies the total length printed, where empty spots are filled with spaces
*/
void
printFloat
(
float
f
,
uint8_t
decimals
,
uint8_t
rightPad
)
{
String
s
=
String
(
f
,
decimals
);
for
(
uint8_t
i
=
s
.
length
();
i
<
rightPad
;
++
i
)
{
...
...
@@ -54,6 +59,11 @@ void printFloat(float f, uint8_t decimals, uint8_t rightPad) {
lcd
.
print
(
s
);
}
/*
* display the temperature of the four temperature sensorse and
* also shows if the pump is running
* shows no temperature if sensor state is in LONG_TIME_ERROR
*/
void
displayText
(
float
t1up_C
,
float
t1down_C
,
bool
pump1
,
float
t2up_C
,
float
t2down_C
,
bool
pump2
,
UPDATESTATE
state_t1up
,
UPDATESTATE
state_t1down
,
UPDATESTATE
state_t2up
,
UPDATESTATE
state_t2down
)
{
// update the display only after a second has passed
...
...
@@ -124,6 +134,7 @@ void displayText(float t1up_C, float t1down_C, bool pump1, float t2up_C, float t
}
}
// turnes the display on for 30 seconds
void
displayLight
(
bool
turnOn
)
{
const
uint32_t
lightMillis
=
30000
;
static
bool
curState
=
false
;
...
...
@@ -140,6 +151,12 @@ void displayLight(bool turnOn) {
}
}
/*
* main setup function
* initialize every electronic component
*/
// main setup function
void
setup
(
void
)
{
lcd
.
init
();
...
...
@@ -153,6 +170,13 @@ void setup(void) {
pinMode
(
BUTTON
,
INPUT_PULLUP
);
}
/*
* main loop function
* 1. Check if button was pressed.
* 2. If button was pressed,turn display on and say the temperetures.
* 3. Check if pumps should be turned on or out.
* 4. Update the display.
*/
void
loop
(
void
)
{
static
float
t1up_C
=
0.0
;
static
float
t1down_C
=
0.0
;
...
...
This diff is collapsed.
Click to expand it.
solarpump/temperature.ino
+
0
−
1
View file @
7c3571e0
...
...
@@ -127,4 +127,3 @@ void temperatureBegin(void) {
dhtT2up
.
begin
();
dhtT2down
.
begin
();
}
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