Navigation

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

    Best posts made by lekeb

    • RE: Water pressure sensor

      Thanks a lot, It works!!!

      Here my code updated

      
      // Enable debug prints to serial monitor
      //#define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      //#define MY_NODE_ID 7
      
      #include <MySensors.h>
      
      #define BARO_CHILD 0
      #define BAR_SENSOR_ANALOG_PIN 0
      
      unsigned long SLEEP_TIME = 60000;
      
      MyMessage pressureMsg(BARO_CHILD, V_PRESSURE);
      void setup(){
        
      }
      
      void presentation() {
        sendSketchInfo("pressure Sensor", "1.0");
        present(BARO_CHILD, S_BARO);
      }
      
      void loop() {
          
        int lecture_adc = analogRead(BAR_SENSOR_ANALOG_PIN);
        float pression = ((lecture_adc*5/1024.0)-0.50)/1.7;
        Serial.println(pression);        
        send(pressureMsg.set(pression, 2));
              
        sleep(SLEEP_TIME);
      }
      
      posted in My Project
      lekeb
      lekeb