Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. romeok01
    3. Topics
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Topics created by romeok01

    • romeok01

      Coal or water level sensor
      My Project • • romeok01  

      2
      0
      Votes
      2
      Posts
      1820
      Views

      maluko

      thanks romeak01 i have update with my sample, i think that will run ok. #include <MySensor.h> #include <SPI.h> //import MySensors library #define trigPin 6 #define echoPin 5 int max = 91; //distance (cm) from min water level to sensor int min = 6; // distance (cm) from max water level to sensor int procent; //distance percentage int ilosc; //amount of the tank as a percentage #define child_id_ilosc 1 //setting to identify the amount of water in the tank MySensor gw; MyMessage msgilosc(child_id_ilosc, V_IMPEDANCE); void setup() { pinMode(trigPin, OUTPUT); //Pin, that its connet to trig pinMode(echoPin, INPUT); //a echo, input gw.begin(); //launch MySensors library gw.sendSketchInfo("Water tank meter", "1.0"); gw.present(child_id_ilosc, S_WEIGHT); //present data to controller } void loop() { long czas, dystans, diferenca; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); czas = pulseIn(echoPin, HIGH); dystans = czas / 58; diferenca = max -min; procent = (((dystans - min) * 100) / diferenca); ilosc = 100 - procent; gw.send(msgilosc.set(ilosc)); // send to controller delay(1000); // delay }```
    • romeok01

      Domoticz 4 x relay
      Development • • romeok01  

      6
      0
      Votes
      6
      Posts
      4713
      Views

      romeok01

      @TheoL Thank you very much, really helped me, now the program code work