Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
language: c
before_install:
# Download and install Arduino IDE environment
- wget http://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
- tar xf arduino-1.8.5-linux64.tar.xz
- sudo mv arduino-1.8.5 /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
install:
# Install the library in the arduino user libraries folder
- ln -s $PWD /usr/local/share/arduino/libraries/Easyuino
script:
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/RGBLedExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/RelayExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/RelayNamedExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/DistanceMeterExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/DistanceMeterNonBlockExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/DistanceMeterAccurateExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Leds/RGBLed/RGBLedExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Relay/RelayExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/Relay/RelayNamed/RelayNamedExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/UltraSonicModule/DistanceMeter/DistanceMeterExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/UltraSonicModule/DistanceMeterNonBlock/DistanceMeterNonBlockExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/UltraSonicModule/DistanceMeterAccurate/DistanceMeterAccurateExample.ino
- arduino --verify --board arduino:avr:uno $PWD/examples/WaterDetector/WaterDetectorExample.ino
notifications:
email:
on_success: change
on_failure: change
on_failure: change
15 changes: 9 additions & 6 deletions Easyuino.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\UltraSonicModule\DistanceMeter.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\UltraSonicModule\DistanceMeterPrintable.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\InfraRedReceiver\InfraRedReceiver.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\Displays\OLEDlcd.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\WaterDetector\RainDetector.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\WaterDetector\WaterDetector.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\Relay\Relay.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\Relay\RelayNamed.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\Utilities\Utilities.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\WaterFlow\WaterFlowMeter.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\main\WaterFlow\WaterFlowSensor.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)src\tests\ManualTest.cpp" />
</ItemGroup>
<ItemGroup>
Expand All @@ -48,8 +49,8 @@
<ClInclude Include="$(MSBuildThisFileDirectory)src\DistanceMeter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\DistanceMeterPrintable.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\InfraRedReceiver.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\OLEDlcd.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\RainDetector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\tests\WaterDetectorTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\WaterDetector.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\Relay.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\RelayNamed.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\RGBLed.h" />
Expand All @@ -63,18 +64,20 @@
<ClInclude Include="$(MSBuildThisFileDirectory)src\tests\RelayNamedTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\tests\RelayTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\tests\RGBLedTest.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\WaterFlowMeter.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)src\WaterFlowSensor.h" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory).gitignore" />
<None Include="$(MSBuildThisFileDirectory).travis.yml" />
<None Include="$(MSBuildThisFileDirectory)examples\Displays\.gitkeep" />
<None Include="$(MSBuildThisFileDirectory)examples\GSM\.gitkeep" />
<None Include="$(MSBuildThisFileDirectory)examples\InfraRedReceiver\.gitkeep" />
<None Include="$(MSBuildThisFileDirectory)examples\RainDetector\.gitkeep" />
<None Include="$(MSBuildThisFileDirectory)examples\WaterFlow\.gitkeep" />
<None Include="$(MSBuildThisFileDirectory)LICENSE" />
<None Include="$(MSBuildThisFileDirectory)README.md" />
</ItemGroup>
<ItemGroup>
<Image Include="$(MSBuildThisFileDirectory)examples\Leds\20171022_232756.jpg" />
<Image Include="$(MSBuildThisFileDirectory)examples\Leds\RGBLed\RGBLedCircuit.jpg" />
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions Keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ updateDistanceNonBlock KEYWORD2
##################################################
DistanceMeterAccurate KEYWORD1
##################################################
# WaterDetector #
##################################################
WaterDetector KEYWORD1
begin KEYWORD2
end KEYWORD2
getWaterStatus KEYWORD2
getWaterStatusRange KEYWORD2
isWaterDetected KEYWORD2
##################################################
# WaterStatus #
##################################################
WaterStatus KEYWORD1
DRY LITERAL1
FEW_DROPS LITERAL1
WET LITERAL1
FLOOD LITERAL1
INVALID LITERAL1
NOT_INITIALIZED LITERAL1
##################################################
# GSMService #
##################################################
GSMService KEYWORD1
Expand Down
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,39 @@ The Easyuino library has 5 fundamental goals:
## Sensors and Devices Support

The development of the library, including fixes and addition of new sensors/devices, will be done depending on:
- My time availability (Now I am doing my Masters Degree Thesis in Computer Science and Engineering that stoles a good slice of my time)
- My time availability (Now I am doing my Masters Degree Thesis in Computer Science and Engineering that stoles a huge slice of my time)
- Interest of people in Easyuino

Important: Nevertheless I will accept suggestions for interesting devices/sensors to develop and if there are a lot of interest I will start prioritize them.

More Important: If you have any question about the library or some doubts about the supported devices you can contact me too !!!
More Important: If you have any question about easyuino you can contact me !!!

Contact Channels:
- Email: easyuino@gmail.com

### Implemented, Documented and Tested = Ready to Use
### Already Implemented, Documented and Tested = Ready to Use

- RGB led, Ultrasonic Module (measure distances) , GSM Module (currently only SMS services), Relay Module
- RGB led
- Ultrasonic Module (measure distances)
- GSM Module (currently only SMS services)
- Relay Module
- Water Detector Sensor

### Currently Developing

- Water/Rain Detector
- Displays: OLED lcd and Seven Segments
- Water Flow Sensor (as a sensor exclusively and as a flow rate meter)
- Seven Segments Display

### Develop in a Near Future

- Infra Red Receiver
- Soil moisture/humidity Sensor
- Photoresistor/Light Sensor
- Flame Sensor
- Infra Red Receiver

### Develop in a Long Term Future

- Temperature/Humidity sensor
- Photoresistors/Light sensor
- Knock sensor
- Sound sensor
- Optical Fingerprint sensor
Expand All @@ -53,6 +58,14 @@ Contact Channels:
3. *[Optional]* Look at https://github.com/Strabox/Easyuino/wiki to usage examples and details about the API
4. **[Not Optional]** Have fun!!!

## Important: API Usage Examples and Additional Information

**Project's wiki has a set of usage examples of the library API plus more detailed information about it: https://github.com/Strabox/Easyuino/wiki**

## Related and Useful Libraries

https://github.com/Strabox/GSMLibrary I have this Arduino library too that is used to interact with GSM/GPRS boards. It is separated from this one because addresses a much more complex device but follows identical rules of Easyuino.

## Easyuino History

I am Computer Scientist and Engineer (not an Electrotechnical one) that loves programming special in C/C++.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,37 @@ RGBLedExample.ino
#include <Easyuino.h> // Include the library in order to the compiler know you want Easyuino library

using Easyuino::RGBLed; // Necessary in order to use RGBLed
using Easyuino::Color; // Necessary for some method calls

int red_pin = 9; // Arduino pin connected to led red pin
int green_pin = 10; // Arduino pin connected to led green pin
int red_pin = 9; // Arduino pin connected to led red pin
int green_pin = 10; // Arduino pin connected to led green pin
int blue_pin = 11; // Arduino pin connected to led blue pin

RGBLed led(red_pin, green_pin, blue_pin); // Create the RGBLed object that exposes the API to use

void setup() {
led.begin(); // Called in setup method to initialize the RGBLed in order to accept requests
led.begin(); // Called in setup method to initialize the RGBLed in order to accept requests
}

void loop() {
/*
- This method call sets the color to YELLOW. There are several ones
you can chose normally as seen in the list below.
- List of Colors Available: RED, GREEN, BLUE, YELLOW, WHITE, ORANGE,
PINK, SALMON, VIOLET, AQUA, BROWN, FIREBRICK, DARKGREY, OLIVE, SKYBLUE
*/
led.setColor(Color::YELLOW);

delay(2000);

/*
- This method call set the led color to RED.
- First parameter controls the amount of red (0-255).
- First parameter controls the amount of green (0-255).
- First parameter controls the amount of blue (0-255).
- The color of the led will be the overlap of the amount of 3 colors. See:
https://en.wikipedia.org/wiki/Additive_color
- You can use this link to pick up RGB colors:
https://en.wikipedia.org/wiki/Additive_color
- You can use this link to pick up RGB colors:
https://www.w3schools.com/colors/colors_picker.asp
*/
led.setColor(255, 0, 0);
Expand All @@ -41,23 +52,15 @@ void loop() {

delay(2000);

/*
- This method sets the color to YELLOW. There are several ones
you can chose normally you can see the list in IDEs.
*/
led.setColor(RGBLed::COLOR::YELLOW);

delay(2000);

/*
- This method will set the color to BLUE. See Hexadecimal color code on how to use it.
- You can use this link to pick up Hexadecimal codes https://www.w3schools.com/colors/colors_picker.asp
/*
- This method will set the color to BLUE. See Hexadecimal color code on how to use it.
- You can use this link to pick up Heaxadecimal codes https://www.w3schools.com/colors/colors_picker.asp
*/
led.setColor("#0000ff");

delay(2000);

/*
/*
- This method will turn off the led. After this call you can't set
the color of the led anymore while led.begin(); is not called again.
*/
Expand Down
13 changes: 6 additions & 7 deletions examples/Relay/RelayExample.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RelayExample.ino

using Easyuino::Relay; // Necessary in order to use Relay

int arduinoPin = 6; // Arduino pin that controls the relay
int arduinoPin = 6; // Arduino pin that controls the relay

Relay relay(arduinoPin); // Create the Relay object that exposes the API to use

Expand All @@ -15,11 +15,10 @@ void setup() {
- Initialize the Relay API.
- The first parameter is TRUE if we connect something to the Normally Closed (NC) of the relay,
and FALSE if we connect to the Normally Open (NO).
- The second parameter is the level of the relay when it is in Normally Closed state.
- The second parameter is the digital level of the relay when it is in Normally Closed state.
This is needed because some relays activate when we put HIGH on the pin and others on LOW.
- relay.begin(); is equal to relay.begin(false, HIGH); which is the common configuration.
*/
relay.begin(false, HIGH);
relay.begin(false, HIGH); // Equivalent to: relay.begin(); which is the common configuration
}

void loop() {
Expand All @@ -38,13 +37,13 @@ void loop() {
delay(2000);

/*
Return TRUE if the device is on and FALSE if it is off
Return true if the device is on and false if it is off
*/
bool result = relay.isOn();

/*
- This method will turn off the relay and after that no more calls to
the relay will work without call the relay.begin(); again.
- This method will turn off the device and after that no more calls to
the relay will be possible without call the relay.begin(); again.
*/
relay.end();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ RelayNamedExample.ino
using Easyuino::RelayNamed; // Necessary in order to use RelayNamed

int arduinoPin = 6; // Arduino pin that controls the relay
char* controlledDevice = "Lamp";// The difference for normal relay is that the relay stays with a name identifier name attached
const char* controlledDevice = "Lamp";// The difference for normal relay is that the relay stays with a name identifier name attached

RelayNamed relayNamed(arduinoPin, controlledDevice); // Create the RelayNamed object that exposes the API to use

void setup() {
Serial.begin(9600); // Used to start the serial connection with the computer. Change the 9600 if needed.
relayNamed.begin(false, HIGH); // See RelayExample.ino for the explanation
relayNamed.begin(false, HIGH); // See RelayExample.ino for the explanation
}

void loop() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
DistanceMeterAccurateExample.ino
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
DistanceMeterNonBlockExample.ino
*/

Expand Down
84 changes: 84 additions & 0 deletions examples/WaterDetector/WaterDetectorExample.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
WaterDetectorExample.ino
*/

#include <Easyuino.h> // Include the library in order to the compiler know you want Easyuino library

using Easyuino::WaterDetector; // Necessary in order to use WaterDetector
using Easyuino::WaterStatus; // Necessary for some methods calls

int digitalPin = 7; // Arduino pin that connects to the digital pin of the sensor (normally called D0)
int analogPin = 6; // Arduino pin that conencts to the analog pin of the sensor (normally called A0)

WaterDetector waterDetector(digitalPin, analogPin); // Create the WaterDetector object that exposes the API to use

void setup() {
/*
Initialize the serial monitor
*/
Serial.begin(9600);
/*
- Initialize the WaterDetector API
- The first parameter is the digital level (HIGH or LOW) that appear in the digital pin when
the water touches the sensor and the amount of it is above the pre-defined threshold set by the
potentiometer of the board. This is necessary because some sensor versions use HIGH others LOW.
*/
waterDetector.begin(LOW); // Equivalent to: waterDetector.begin(); which is the common configuration
}

void loop() {
/*
This API call will return true when water is detected in the sensor and false otherwise.
*/
bool res = waterDetector.isWaterDetected();
Serial.println(res);

delay(2000);

/*
This API call will return a set of results (see C++ enumerates) that you can compare to see
how much water is touching the sensor.
WARNING: This reading is independent from the above one because the above one is controlled by
the physical potentiometer and digital pin of the sensor. On the other hand the
getWaterStatus uses the analog pin to decide how "wet" :) the sensor is.
*/
WaterStatus status = waterDetector.getWaterStatus();

if (status == WaterStatus::DRY) {
Serial.println("Sensor is dry!");
}
else if (status == WaterStatus::FEW_DROPS) {
Serial.println("Sensor has a few drops in it!");
}
else if (status == WaterStatus::WET) {
Serial.println("Sensor is wet!");
}
else if (status == WaterStatus::FLOOD) {
Serial.println("Sensor is flooded!");
}
else if (status == WaterStatus::INVALID) {
Serial.println("Sensor had a strange invalid reading!");
}
else {
Serial.println("Begin method was not called!");
}

delay(2000);

/*
This API call is more advanced basically it gives you a number from [0,1023] to describe how "wet"
:) the sensor is. 1023 is when the sensor is completely dry and 0 when is completely flooded.
Note: The method getWaterStatus is based on this call.
*/
unsigned int howWet = waterDetector.getWaterStatusRange();
Serial.println(howWet);

delay(2000);

/*
This API call will terminate the sensing ability of the water detector and all the requests
after this one will be invalid. If you want use the sensor again you must call the begin
method again.
*/
waterDetector.end();
}
1 change: 1 addition & 0 deletions examples/WaterFlow/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pragma once
Loading