Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Fonseca Yarochewsky
2014-15
Commits
9370911e
Commit
9370911e
authored
Apr 11, 2015
by
Beck-Sisyphus
Browse files
Science station code. Credit to Ahmed Awadallah
parent
a9bdf334
Changes
5
Hide whitespace changes
Inline
Side-by-side
.DS_Store
View file @
9370911e
No preview for this file type
Arduino Code/.DS_Store
View file @
9370911e
No preview for this file type
Arduino Code/December_6_14/.DS_Store
0 → 100644
View file @
9370911e
File added
Arduino Code/Humidity_Code_V2.ino
0 → 100644
View file @
9370911e
const
int
humPin
=
A0
;
int
readingNumber
=
0
;
double
readingSum
=
0
;
boolean
calibrated
=
true
;
double
calibratedValue
=
640.0
;
void
setup
()
{
// initialize serial communications:
Serial
.
begin
(
9600
);
}
void
loop
()
{
// read the value from the pin
double
humReading
=
0
;
humReading
=
analogRead
(
humPin
);
readingSum
+=
humReading
;
// calculate the sensor humidity
if
(
calibrated
){
double
sensorRH
=
humReading
/
calibratedValue
*
100.0
;
Serial
.
print
(
sensorRH
);
Serial
.
println
(
"%"
);
// wait a second
delay
(
1000
);
}
//Water Calibration
if
(
readingNumber
==
10
&&
calibrated
){
double
readingAvg
=
readingSum
/
10.0
;
Serial
.
println
(
readingAvg
);
Serial
.
println
(
humReading
);
readingNumber
=
0
;
readingSum
=
0
;
}
delay
(
100
);
readingNumber
++
;
}
Arduino Code/SensorCodepH.ino
0 → 100644
View file @
9370911e
int
TimeBetweenReadings
=
500
;
void
setup
()
{
// initialize serial communication at 9600 bits per second:
Serial
.
begin
(
9600
);
Serial
.
println
(
"Time (s) Voltage Readings from A0 (N)"
);
}
void
loop
()
{
float
Count
;
float
Voltage
;
float
SensorReading
;
int
ReadingNumber
=
0
;
float
Time
;
//the print below does the division first to avoid overflows
//Serial.print(ReadingNumber/1000.0*TimeBetweenReadings);
Count
=
analogRead
(
A0
);
Voltage
=
Count
/
1023
*
5.0
;
// convert from count to raw voltage
//Serial.print(" ");
Serial
.
print
(
"Voltage: "
);
Serial
.
println
(
Voltage
);
Serial
.
print
(
"pH: "
);
Serial
.
println
(
Voltage
/
0.36
);
delay
(
TimeBetweenReadings
);
// delay in between reads for stability
ReadingNumber
++
;
}
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