Reading and displaying analog values from other node

122 views
Skip to first unread message

Artur

unread,
Aug 1, 2016, 9:40:08 AM8/1/16
to souliss
Hi.

Howto read analog values (temperature, humidity...) from other node (in my case gateway). 
PullData, read data are changing when temperature are changing buy I don't know how to easily convert read values back to float type.
RemoteInputs, always returns zero.

I'm using WeMos D1 mini with Oled shield as node and Ethernet gateway with sensors.

Artur

Di Maio, Dario

unread,
Aug 2, 2016, 3:16:34 PM8/2/16
to sou...@googlegroups.com

Hi Artur,

mOutputAsFloat(slot) should work for you.

Regards,
Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/64ee8b78-2a8c-4144-8985-2bffa3d06597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andreas Karl

unread,
Aug 10, 2016, 1:11:58 AM8/10/16
to souliss
If you have it working can you please post your sketches? (peer and gw)

Andreas Karl

unread,
Aug 10, 2016, 12:28:52 PM8/10/16
to souliss
I get the correct temp & humidity on my peer

// Let the IDE point to the Souliss framework
#include "SoulissFramework.h"

// Configure the framework
#include "bconf/StandardArduino.h"          // Use a standard Arduino
#include "conf/usart.h"                     // USART RS485

#define USARTDRIVER_INSKETCH
#define USART_TXENABLE          1
#define USART_TXENPIN           3
#define USARTDRIVER             Serial
/*************/

// Include framework code and libraries
#include <SPI.h>

/*** All configuration includes should be above this line ***/ 
#include "Souliss.h"
#include <DHT.h>
DHT dht;
float th=0;

// Define the RS485 network configuration
#define myvNet_subnet   0xFF00
#define Gateway_RS485   0xCE01
#define Peer_RS485      0xCE02

# define ROW1B2_TEMPERATURE                              5
# define ROW1B2_HUMIDITY                                7
#define  grh_Logic_Humidity(slot)    Souliss_Logic_T53(memory_map, slot, 0.02, &data_changed)
#define  grh_Logic_Temperature(slot)   Souliss_Logic_T52(memory_map, slot, 0.01, &data_changed)

inline void DefineTypicals()
{

  Set_Temperature(ROW1B2_TEMPERATURE);
  Set_Humidity(ROW1B2_HUMIDITY);
  dht.setup(2);
}

inline void ProcessLogics()
{
  grh_Logic_Humidity(ROW1B2_HUMIDITY);
  grh_Logic_Temperature(ROW1B2_TEMPERATURE);
}

inline void ProcessTimers()
{
  Serial.print("\n");
  th = dht.getHumidity();
  Serial.print(th, 1);
  ImportAnalog(ROW1B2_HUMIDITY, &th);
  Serial.print("\t\t");
  th = dht.getTemperature();
  Serial.print(th, 1);
  ImportAnalog(ROW1B2_TEMPERATURE, &th);
}

void setup()
{   
    Initialize();
    
    // Set network parameters
    SetAddress(Peer_RS485, myvNet_subnet, Gateway_RS485);      
DefineTypicals();
    Serial.begin(9600);
  Serial.println();
}



void loop()
    // Here we start to play
    EXECUTEFAST() {                     
        UPDATEFAST();   


        FAST_50ms()
    {
      ProcessLogics();

      
    }

    FAST_2110ms()
    {
      ProcessTimers();

    }

        FAST_PeerComms();
        
    }
    
    EXECUTESLOW() { 
        UPDATESLOW();

        SLOW_10s() {               

        } 
    }   
    

but I really don't know how to serial.print it on my gateway (connection over rs485)

Di Maio, Dario

unread,
Aug 10, 2016, 12:44:10 PM8/10/16
to sou...@googlegroups.com

You should use Persistance or LastIn (suggested), details on the wiki.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.

To post to this group, send email to sou...@googlegroups.com.

Andreas Karl

unread,
Aug 12, 2016, 2:03:24 AM8/12/16
to souliss
Ok I got it working with LastIn:
#include "conf/Gateway_wLastin.h"
Serial.print(LastIn_GetAnalog(1,5));          //Temp
Serial.print(LastIn_GetAnalog(1,7));          //Humid
but with Persistence I only get 0.00 values
#include "conf/Gateway_wPersistence.h"
Serial
.print(pOutputAsFloat(1,5));          //Temp
Serial.print(pOutputAsFloat(1,7));          //Humid

on a Mega2560
what is wrong?

Di Maio, Dario

unread,
Aug 12, 2016, 7:12:02 AM8/12/16
to sou...@googlegroups.com
Looks strange, you are not supposed to do anything else to work with Persistence. I assume that those values are available in SoulissApp without any problem when Persistence is set.

Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages