Combined sketch PH meter and Temp Sensor



  • Hi everyone,

    I just got a compiled sketch with a ph sensor and temp sensor however i push the values to pimatic. however i have the ph meter as child id 0, and the temp as child id 1. however it seems that both values are on child 1.

    Can anyone have a look at my sketch to see where the error is?
    0_1460752368057_PH_Probe_v1.1.ino.ino


  • Mod

    You have set numSensors to 0 which means you will never present any temperature sensors. I think you need to change

    int numSensors=0;
    

    to

    int numSensors=1;
    

    and

        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
        gw.present(i, S_TEMP);
        }
    

    to

        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
        gw.present(i+CHILD_ID_TEMP, S_TEMP);
        }
    

    Also use the auto-formatting (Ctrl/Cmd+T) in Arduino IDE, it makes it easier to follow the code and spot mistakes.



  • These are the reading i got.

    send: 2-2-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
    send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
    send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    read: 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    sensor started, id=2, parent=0, distance=1
    send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=7,sg=0,st=ok:pHmeter
    send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
    send: 2-2-0-0 s=0,c=0,t=21,pt=0,l=0,sg=0,st=ok:
    send: 2-2-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=ok:
    pH:3.36
    send: 2-2-0-0 s=0,c=1,t=24,pt=7,l=5,sg=0,st=ok:3.36
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:21.3
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:21.1
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:21.0
    send: 2-2-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:20.8
    pH:3.86
    send: 2-2-0-0 s=0,c=1,t=24,pt=7,l=5,sg=0,st=ok:3.86

    The 14.79 is from the PH the rest the temp sensor.

    as you can see both values are on parent 0. is it possible to get the ph on parent 0 and the temp on 1?


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 17
  • 3
  • 2
  • 9

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts