Skip to content

JEAPI-DEV/Grove-Water-Level-Sensor

 
 

Repository files navigation

Grove Water Level Library

This tiny library is for reading the current level from the Grove Water Level Sensor. Please note that the code behind this library is from Seeed Studio - Grove Water Level Sensor. I've only put the code into a library to reduce code in my Arduino project, and now I would like to share this with you.

Note from me (the forker): I forked the original project because:

A: The example cannot be found under the Arduino IDE since there is none, except on the readme.
B: I added 'readCM' because why not.
C: The most important reason is that you cannot directly download the library under releases. The result is that you have to download (git clone) the project, then unzip it, go inside the folder, and zip it anew without the readme

Project Screenshots:

project-screenshot


project-screenshot

🧐 Features

Here're some of the project's best features:

  • Getting the Data out of the Sensor without unnecessary complexity
  • Get Percentage
  • Get Centimetre

🛠️ Installation Steps:

1. Go under Releases and download the waterlevelsensor.zip. Then include it in the Arduino IDE by hovering over Sketch -> Include Library -> Add .ZIP Library

2. Go under File -> Examples -> Grove_Water_Level_Sensor and upload the code or simply copy paste this code:

#include <waterlevelsensor.h>

WaterLevelSensor sensor = WaterLevelSensor();

void setup() {
  Serial.begin(9600);
}

void loop() {
  //lesen des Grove Wasser Level Sensors
  int waterLevel = sensor.readPercentage();
  int waterLevelinCM = sensor.readCM();

  //Ausgeben des ermittelten Wertes
  Serial.print(waterLevel);
  Serial.println("%");
  Serial.print(waterLevelinCM);
  Serial.println(" cm");
  Serial.println("--------------------------");
  
  delay(500);
}

About

Adding an example, the ability to directly read in cm.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%