-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensorMonitor.cpp
More file actions
31 lines (26 loc) · 963 Bytes
/
SensorMonitor.cpp
File metadata and controls
31 lines (26 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// This library was written as a Software Engineering Senior Project for
// the CSE Department of Mississippi State University
// Authors: Spencer Barnes, Jordan Stremming, Tyler Whiticker, Jake Griesmer
// A collection of functions to assist in the sending data from an Arduino
// board and its sensors to an external machine. To be used in conjunction
// with JsonSerialStream
// This library is intended to be expanded upon to handle more sensors.
#include "SensorMonitor.h"
/*
Ultrasonic or Sonar Sensors
*/
// Add sonar data object from New Ping ultrasonic sensors to Stream
// {"data":<int>, "units":"cm"}
void getSonarObject(NewPing sonarSensor, JsonSerialStream &outgoing)
{
outgoing.addProperty("data", sonarSensor.ping_cm());
outgoing.addProperty("units", "cm");
}
/*
Limit switch or Pin input Sensors
*/
// Returns value of Arduino Pin wired to limit switch
bool getLimitSwitchData(int switchPin)
{
return digitalRead(switchPin);
}