USART connection problem

47 views
Skip to first unread message

Miguel Angel de Pablo

unread,
Jun 24, 2019, 9:46:14 AM6/24/19
to souliss

Hello
I'm trying to make a node USE with an ESP01 and a mega arduino and I can not get the typical ones out in the APP, here are the codes

Gateway

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

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#include "conf/usart.h"                      // USART
#include "conf/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID            
#define WiFi_Password    

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

// define ip fija
//########################
uint8_t ip_address
[4]  = {192, 168, 1, 50};
uint8_t subnet_mask
[4] = {255, 255, 255, 0};
uint8_t ip_gateway
[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]  

// Include and Configure DHT11 SENSOR
#include "DHT.h"
#define DHTPIN              2       // what pin we're connected to D0
#define DHTTYPE             DHT11   // DHT 22
DHT dht
(DHTPIN, DHTTYPE);      


// This identify the number of the LED logic
#define PRESSURE0    0
#define BMP180TEMP    2
#define TEMPERATURE         4
#define HUMIDITY            6

// SDA and SCL pins can be configured, you need to edit SFE_BMP180/SFE_BMP180.cpp line 38. Preconfigured at 14, 12.
#include <SFE_BMP180.h>
// #include <Wire.h>
#define ALTITUDE 753.0 // Altitude of reading location in meters


// You will need to create an SFE_BMP180 object, here called "pressure":
SFE_BMP180 pressure
;

#define Debug Serial        //Change to Serial1 if you want to use the GPIO2 to TX
#define DebugDHT            1       //0 - None      / 1 - Show data on Serial  
#define Celsius             1       //0 - Farenheit / 1 Celsius

void setup()
{  
   
Initialize();
   
Debug.begin(115200);
   
Debug.println("DHTxx test!");
    dht
.begin();
   
 
// Connect to the WiFi network and get an address from DHCP
   
Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
   
   
SetAsGateway(myvNet_address); // Set this node as gateway for SoulissApp  

   
// This is the vNet address for this node, used to communicate with other
 
// nodes in your Souliss network
   
SetAddress(0xAB01, 0xFF00, 0x0000);
   
SetAddress(0xD001, 0xFF00, 0x0000);

 
//Nodos
 
 
SetAsPeerNode(0xAB02, 1); // luces valla
 
SetAsPeerNode(0xAB03, 2); // riego
 
SetAsPeerNode(0xAB04, 3); // luces terraza
 
SetAsPeerNode(0xAB05, 4); // casa
 
SetAsPeerNode(0xAB06, 5); // luces esquina norte
 
SetAsPeerNode(0xAB07, 6); // caseta grande
 
SetAsPeerNode(0xAB08, 7); // caseta pequeña
 
SetAsPeerNode(0xAB09, 8); // luces esquina sur
 
SetAsPeerNode(0xAB0A, 9); // piscina
 
SetAsPeerNode(0xAB0B, 10); // puerta atras
 
//SetAsPeerNode(0xD002, 10);// riego nuevo USART
 
SetAsPeerNode(0xAB0C, 11); // SENSOR CASETA
 

   
Set_Pressure(PRESSURE0);
   
Set_Temperature(BMP180TEMP);
   
Set_Temperature(TEMPERATURE);
   
Set_Humidity(HUMIDITY);

   
if (pressure.begin())
       
Debug.println("BMP180 init success");
   
else
     
{
             
// Oops, something went wrong, this is usually a connection problem,
             
// see the comments at the top of this sketch for the proper connections.
             
Debug.println("BMP180 init fail\n\n");
     
}
}


void loop()
{
    EXECUTEFAST
() {                    
        UPDATEFAST
();

         FAST_2110ms
()
       
{
           
Logic_Temperature(TEMPERATURE);
           
Logic_Humidity(HUMIDITY);
       
}
       
// Here we handle here the communication with Android
        FAST_GatewayComms
();                                        
   
}
  EXECUTESLOW
() {
    UPDATESLOW
();
    SLOW_10s
() {  // Read temperature and humidity from DHT every 110 seconds  
     
Logic_Pressure(PRESSURE0);
     
Logic_Temperature(BMP180TEMP);
     
Souliss_ReadDHT(TEMPERATURE, HUMIDITY);
   
}
    SLOW_50s
() {
     
Souliss_GetPressure_BMP180(PRESSURE0,BMP180TEMP);
   
}
 
}
}    
   
/***************************************************************************/
/*                         BMP180 I2C READING FUNCTION                     */
/***************************************************************************/
float Souliss_GetPressure_BMP180(uint8_t SLOT_PRESSURE, uint8_t SLOT_TEMPERATURE){
 
 
boolean DEBUG_PRESSURE = 0;
 
 
char status;
 
double T,P,p0,a;


 
// Loop here getting pressure readings every 10 seconds.


 
// If you want sea-level-compensated pressure, as used in weather reports,
 
// you will need to know the altitude at which your measurements are taken.
 
// We're using a constant called ALTITUDE in this sketch:
 
 
if(DEBUG_PRESSURE){
   
Debug.println();
   
Debug.print("provided altitude: ");
   
Debug.print(ALTITUDE,0);
   
Debug.print(" meters, ");
   
Debug.print(ALTITUDE*3.28084,0);
   
Debug.println(" feet");
 
}  
 
// If you want to measure altitude, and not pressure, you will instead need
 
// to provide a known baseline pressure. This is shown at the end of the sketch.


 
// You must first get a temperature measurement to perform a pressure reading.
 
 
// Start a temperature measurement:
 
// If request is successful, the number of ms to wait is returned.
 
// If request is unsuccessful, 0 is returned.


  status
= pressure.startTemperature();
 
if (status != 0)
 
{
   
// Wait for the measurement to complete:
    delay
(status);


   
// Retrieve the completed temperature measurement:
   
// Note that the measurement is stored in the variable T.
   
// Function returns 1 if successful, 0 if failure.


    status
= pressure.getTemperature(T);
   
if (status != 0)
   
{
     
if(DEBUG_PRESSURE){
       
// Print out the measurement:
       
Debug.print("temperature: ");
       
Debug.print(T,2);
       
Debug.print(" deg C, ");
       
Debug.print((9.0/5.0)*T+32.0,2);
       
Debug.println(" deg F");
     
}    
     
// Start a pressure measurement:
     
// The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
     
// If request is successful, the number of ms to wait is returned.
     
// If request is unsuccessful, 0 is returned.


      status
= pressure.startPressure(3);
     
if (status != 0)
     
{
       
// Wait for the measurement to complete:
        delay
(status);


       
// Retrieve the completed pressure measurement:
       
// Note that the measurement is stored in the variable P.
       
// Note also that the function requires the previous temperature measurement (T).
       
// (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
       
// Function returns 1 if successful, 0 if failure.


        status
= pressure.getPressure(P,T);
       
if (status != 0)
       
{
         
if(DEBUG_PRESSURE){
           
// Print out the measurement:
           
Debug.print("absolute pressure: ");
           
Debug.print(P,2);
           
Debug.print(" mb, ");
           
Debug.print(P*0.0295333727,2);
           
Debug.println(" inHg");
         
}
         
// The pressure sensor returns abolute pressure, which varies with altitude.
         
// To remove the effects of altitude, use the sealevel function and your current altitude.
         
// This number is commonly used in weather reports.
         
// Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.
         
// Result: p0 = sea-level compensated pressure in mb


          p0
= pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO)
         
if(DEBUG_PRESSURE){
           
Debug.print("relative (sea-level) pressure: ");
           
Debug.print(p0,2);
           
Debug.print(" mb, ");
           
Debug.print(p0*0.0295333727,2);
           
Debug.println(" inHg");
         
}
         
// On the other hand, if you want to determine your altitude from the pressure reading,
         
// use the altitude function along with a baseline pressure (sea-level or other).
         
// Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.
         
// Result: a = altitude in m.


          a
= pressure.altitude(P,p0);
         
if(DEBUG_PRESSURE){
           
Debug.print("computed altitude: ");
           
Debug.print(a,0);
           
Debug.print(" meters, ");
           
Debug.print(a*3.28084,0);
           
Debug.println(" feet");
         
}
         
float pressure = p0;
         
float temperature = T;
         
Souliss_ImportAnalog(memory_map, SLOT_PRESSURE, &pressure);
         
Souliss_ImportAnalog(memory_map, SLOT_TEMPERATURE, &temperature);
         
return p0;
       
}
       
else if(DEBUG_PRESSURE) Debug.println("error retrieving pressure measurement\n");
     
}
     
else if(DEBUG_PRESSURE) Debug.println("error starting pressure measurement\n");
   
}
   
else if(DEBUG_PRESSURE) Debug.println("error retrieving temperature measurement\n");
 
}
 
else if(DEBUG_PRESSURE) Debug.println("error starting temperature measurement\n");
 
}

void Souliss_ReadDHT(uint8_t TEMPERATURE_SLOT, uint8_t HUMIDITY_SLOT){
   
// Read temperature and humidity from DHT every 10 seconds  
   
float h = dht.readHumidity();
   
// Read temperature as Celsius
   
float t = dht.readTemperature();
   
// Read temperature as Fahrenheit
   
float f = dht.readTemperature(true);

   
// Check if any reads failed and exit early (to try again).
   
if (isnan(h) || isnan(t) || isnan(f)) {
       
Debug.println("Failed to read from DHT sensor!");
   
}
   
if(DebugDHT){
       
Debug.print("Humidity: ");
       
Debug.print(h);
       
Debug.print(" %\t");
       
if(Celsius){
           
Debug.print("Temperature: ");
           
Debug.print(t);
           
Debug.print(" *C ");
       
}else{
           
Debug.print("Temperature: ");
           
Debug.print(f);
           
Debug.print(" *F ");
       
}
   
}
               
   
if(Celsius) Souliss_ImportAnalog(memory_map, TEMPERATURE_SLOT, &t);
   
else Souliss_ImportAnalog(memory_map, TEMPERATURE_SLOT, &f);
   
Souliss_ImportAnalog(memory_map, HUMIDITY_SLOT, &h);
}


BRIDGE ESP01


#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#include "conf/usart.h"                      // USART 
#include "conf/IPBroadcast.h"

// Define the WiFi name and password
#define WIFICONF_INSKETCH
#define WiFi_SSID             
#define WiFi_Password    

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

// define ip fija 
//########################
uint8_t ip_address[4]  = {192, 168, 1, 60};
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]       // The last byte of the IP address (77) is also the vNet address


void setup()
{   
    Initialize();

    // Connect to the WiFi network and get an address from DHCP
   Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
   
    // This is the vNet address for this node, used to communicate with other
    // nodes in your Souliss network
    SetAddress(0xAB0B, 0xFF00, 0xAB01);
    SetAddress(0xD001, 0xFF00, 0x0000);
}

void loop()
{
   

    FAST_BridgeComms();
}

PEER


#include "SoulissFramework.h"

#include "bconf/StandardArduino.h"       
#include "conf/usart.h"     

// Include framework code and libraries
#include <EEPROM.h>
#include "DHT.h"
#include "Souliss.h"
/*#include <FastIO.h>
#include <I2CIO.h>
#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C_ByVac.h>
#include <LiquidCrystal_SI2C.h>
#include <LiquidCrystal_SR.h>
#include <LiquidCrystal_SR1W.h>
#include <LiquidCrystal_SR2W.h>
#include <LiquidCrystal_SR3W.h>
#include <SI2CIO.h>
#include <SoftI2CMaster.h>*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

// Definición de SLOTs
#define TEMPERATURE          0
#define HUMIDITY             2
#define RELE_SLOT1           4 
#define RELE_SLOT2           5


//Definicion de pines

#define DHTPIN              4      // what pin we're connected to
#define DHTTYPE             DHT21   // DHT 12 

#define RELE_SLOT1          5    //relé
#define RELE_SLOT2          6    //relé

// i2c pin d1 y d2

#define BOTON               2 // pin d2


DHT dht(DHTPIN, DHTTYPE); /* quitado el ,15 */

#define Debug               Serial  //Change to Serial1 if you want to use the GPIO2 to TX
#define DebugDHT            0       //0 - None      / 1 - Show data on Serial  
#define Celsius             1       //0 - Farenheit / 1 Celsius     

    
void setup(){ 
  
  Initialize();

    Debug.begin(115200); 
    Debug.println("DHTxx test!");
    dht.begin();

     SetAddress(0xD002, 0xFF00, 0xD001); //Peer1
    
    //LCD

    // Inicializar el LCD
  lcd.init();
  
  //Encender la luz de fondo.
  lcd.backlight();

  lcd.print("INICIO NODO RIEGO");
  delay(1500);
  lcd.clear();

    
    Set_Temperature(TEMPERATURE);
    Set_Humidity(HUMIDITY);
    
   
    Set_SimpleLight(RELE_SLOT1); // Define la logica 
    Set_SimpleLight(RELE_SLOT2); // Define la logica 
    
    
    digitalWrite(RELE_SLOT1, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT2, HIGH); // para evitar falsos encendido
    
    
    pinMode(RELE_SLOT1, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT2, OUTPUT); // pin de salida   
    pinMode(BOTON,INPUT); // y BOTON como señal de entrada 

    
    
}

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

           FAST_2110ms()
        {
           Logic_Temperature(TEMPERATURE);
           Logic_Humidity(HUMIDITY);
           
           
        
           // Read temperature and humidity from DHT every 10 seconds  
           float h = dht.readHumidity();
           // Read temperature as Celsius
           float t = dht.readTemperature();

           
              // Check if any reads failed and exit early (to try again).
              if (isnan(h) || isnan(t)) {
                Serial.println("Failed to read from DHT sensor!");
                //return;
              }
              Serial.print("Humidity: ");
              Serial.print(h);
              Serial.print(" %\t");
              Serial.print("Temperature: ");
              Serial.print(t);
              Serial.print(" *C ");
              Serial.print(" %\t");


              
              
              
            Souliss_ImportAnalog(memory_map, TEMPERATURE, &t);
            Souliss_ImportAnalog(memory_map, HUMIDITY, &h);
            
             }
             
           FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds

               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT1);
               Logic_SimpleLight(RELE_SLOT1);
               LowDigOut(5, Souliss_T1n_Coil, RELE_SLOT1);
              
               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT2);
               Logic_SimpleLight(RELE_SLOT2);
               LowDigOut(6, Souliss_T1n_Coil, RELE_SLOT2);

           }
               
              
            FAST_110ms(){
              
               if((mOutput(RELE_SLOT1))== 0) { 
                     if((mOutput(RELE_SLOT1))== 0);{
                     Serial.println ("  APAG ");}
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,0);
                     lcd.print("APAG");
 
               }
                          
               else{
                    if((mOutput(RELE_SLOT1))== 1); {
                    Serial.println ("  ENCE ");}
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,0);
                     lcd.print("ENCE");
               }

               if((mOutput(RELE_SLOT2))== 0) { // slot 14
                     if((mOutput(RELE_SLOT1))== 0);{
                     Serial.println ("  APAG ");}
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,0);
                     lcd.print("APAG");
               }
                          
               else{
                    if((mOutput(RELE_SLOT2))== 1); {
                    Serial.println ("  ENCE ");}
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,0);
                     lcd.print("ENCE");
               }
            
            
               
 
    }  
            FAST_PeerComms();
            START_PeerJoin();
    }
        EXECUTESLOW() {
            UPDATESLOW();
            SLOW_PeerJoin();
     }          
}
I have connected the mega to the ESP01 crossing the TX and RX cables

excuse my english use the Google translator, the forum of Souliss in Spanish is very unemployed

a greeting

Enrique Hurtado

unread,
Jun 26, 2019, 6:14:05 AM6/26/19
to souliss
Hi, try commenting on this line.
SetAsPeerNode(0xAB0B, 10); // puerta atras
this is the bridge address and it's defined as peer. And remove comment the USART node

Miguel Angel de Pablo

unread,
Jun 26, 2019, 6:42:08 PM6/26/19
to souliss
from what I understand, you say do this:

>  
//SetAsPeerNode(0xAB0B, 10); // puerta atras (remove)
SetAsPeerNode(0xD002, 10);// riego nuevo USART(OK)

if that's it I've already tried it and the gateway does not connect unless you say to remove the two
a greeting
 

Enrique Hurtado

unread,
Jun 27, 2019, 1:20:01 AM6/27/19
to souliss


hi, on the spanish forum you can read about this. there is a manual talking aboutl it.  I paste you the link.

Regards,
Enrique.

Miguel Angel de Pablo

unread,
Jun 27, 2019, 11:21:44 AM6/27/19
to souliss
hola, he probado segun los ejemplos y sigue sin conectarse, bueno, conectarse a la red se conecta porque veo una IP nueva ( o la fija ) pero de la red de souliss no se ve nada ni tiene salud ni cuando refresco la base de datos sale ningun tipical
vuelvo a poner los sketch

gateway

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

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#include "conf/usart.h"                      // USART 
#include "conf/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID             
#define WiFi_Password     


// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

// define ip fija 
//########################
uint8_t ip_address[4]  = {192, 168, 1, 50}; 
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]  
#define myvNet_subnet   0xFF00
  // SetAddress(0xD001, 0xFF00, 0x0000);

  //Nodos 
  
  SetAsPeerNode(0xAB02, 1); // luces valla
  SetAsPeerNode(0xAB03, 2); // riego
  SetAsPeerNode(0xAB04, 3); // luces terraza
  SetAsPeerNode(0xAB05, 4); // casa
  SetAsPeerNode(0xAB06, 5); // luces esquina norte
  SetAsPeerNode(0xAB07, 6); // caseta grande
  SetAsPeerNode(0xAB08, 7); // caseta pequeña
  SetAsPeerNode(0xAB09, 8); // luces esquina sur
  SetAsPeerNode(0xAB0A, 9); // piscina
  //SetAsPeerNode(0xAB0B, 10); // puerta atras

Bridge

#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#include "conf/usart.h"                      // USART 
#include "conf/IPBroadcast.h"

// Define the WiFi name and password
#define WIFICONF_INSKETCH
#define WiFi_SSID             
#define WiFi_Password     

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

void setup()
{   
    Initialize();

    // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                           

    // This is the vNet address for this node, used to communicate with other
    // nodes in your Souliss network
    SetAddress(0xAB0B, 0xFF00, 0xAB01);
    SetAddress(0xD001, 0xFF00, 0x0000);
}

void loop()
{
   

    FAST_BridgeComms();
}

Peer

#define RELE_SLOT3           6 
#define RELE_SLOT4           7
#define RELE_SLOT5           8
#define RELE_SLOT6           9

//Definicion de pines

#define DHTPIN              4      // what pin we're connected to
#define DHTTYPE             DHT21   // DHT 12 

#define RELE_SLOT1          5    //relé
#define RELE_SLOT2          6    //relé
#define RELE_SLOT3          7    //relé
#define RELE_SLOT4          8   //relé
#define RELE_SLOT5          9    //relé
#define RELE_SLOT6          10   //relé


#define BOTON              12  // pin d2


DHT dht(DHTPIN, DHTTYPE); /* quitado el ,15 */

//#define Debug               Serial  //Change to Serial1 if you want to use the GPIO2 to TX
// #define DebugDHT            0       //0 - None      / 1 - Show data on Serial  
#define Celsius             1       //0 - Farenheit / 1 Celsius     

    
void setup(){ 
  
  Initialize();
/*
    Debug.begin(115200); 
    Debug.println("DHTxx test!");
    dht.begin();
*/
     SetAddress(0xD002, 0xFF00, 0xD001); //Peer1
     
    //LCD

    // Inicializar el LCD
  lcd.init();
  
  //Encender la luz de fondo.
  lcd.backlight();

  lcd.setCursor(4,0);
  lcd.print("NODO RIEGO");
  lcd.setCursor(6,1);
  lcd.print("CASA");
  delay(7000);
  lcd.clear();

    
    Set_Temperature(TEMPERATURE);
    Set_Humidity(HUMIDITY);
    
   
    Set_SimpleLight(RELE_SLOT1); // Define la logica 
    Set_SimpleLight(RELE_SLOT2); // Define la logica 
    Set_SimpleLight(RELE_SLOT3); // Define la logica 
    Set_SimpleLight(RELE_SLOT4); // Define la logica 
    Set_SimpleLight(RELE_SLOT5); // Define la logica 
    Set_SimpleLight(RELE_SLOT6); // Define la logica
    
    digitalWrite(RELE_SLOT1, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT2, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT3, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT4, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT5, HIGH); // para evitar falsos encendido
    digitalWrite(RELE_SLOT6, HIGH); // para evitar falsos encendido
    
    pinMode(RELE_SLOT1, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT2, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT3, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT4, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT5, OUTPUT); // pin de salida 
    pinMode(RELE_SLOT6, OUTPUT); // pin de salida  
    
    pinMode(BOTON,INPUT); // y BOTON como señal de entrada 

    
    
}

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

           FAST_2110ms()
        {
           Logic_Temperature(TEMPERATURE);
           Logic_Humidity(HUMIDITY);
           
           
        
           // Read temperature and humidity from DHT every 10 seconds  
           float h = dht.readHumidity();
           // Read temperature as Celsius
           float t = dht.readTemperature();
/*
           
              // Check if any reads failed and exit early (to try again).
              if (isnan(h) || isnan(t)) {
                Serial.println("Failed to read from DHT sensor!");
                //return;
              }
              Serial.print("Humidity: ");
              Serial.print(h);
              Serial.print(" %\t");
              Serial.print("Temperature: ");
              Serial.print(t);
              Serial.print(" *C ");
              Serial.print(" %\t");

*/
              
              
              
            Souliss_ImportAnalog(memory_map, TEMPERATURE, &t);
            Souliss_ImportAnalog(memory_map, HUMIDITY, &h);
            
             }
             
           FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds

               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT1);
               Logic_SimpleLight(RELE_SLOT1);
               LowDigOut(5, Souliss_T1n_Coil, RELE_SLOT1);
              
               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT2);
               Logic_SimpleLight(RELE_SLOT2);
               LowDigOut(6, Souliss_T1n_Coil, RELE_SLOT2);

                DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT3);
               Logic_SimpleLight(RELE_SLOT3);
               LowDigOut(7, Souliss_T1n_Coil, RELE_SLOT3);
              
               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT4);
               Logic_SimpleLight(RELE_SLOT4);
               LowDigOut(8, Souliss_T1n_Coil, RELE_SLOT4);

                DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT5);
               Logic_SimpleLight(RELE_SLOT5);
               LowDigOut(9, Souliss_T1n_Coil, RELE_SLOT5);
              
               DigIn(BOTON, Souliss_T1n_OffCmd, RELE_SLOT6);
               Logic_SimpleLight(RELE_SLOT6);
               LowDigOut(10, Souliss_T1n_Coil, RELE_SLOT6);

           }
               
              
            FAST_110ms(){

              // zona 1
              
               if((mOutput(RELE_SLOT1))== 0) { 
                     if((mOutput(RELE_SLOT1))== 0);{
                    // Serial.println ("  APAG1 ");
                    }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,0);
                     lcd.print("APAG");
 
               }
                          
               else{
                    if((mOutput(RELE_SLOT1))== 1); {
                   // Serial.println ("  ENCE1 ");
                   }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,0);
                     lcd.print("ENCE");
               }
               
               // zona 2 

               if((mOutput(RELE_SLOT2))== 0) { // slot 14
                     if((mOutput(RELE_SLOT1))== 0);{
                    // Serial.println ("  APAG2 ");
                    }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,0);
                     lcd.print("APAG");
               }
                          
               else{
                    if((mOutput(RELE_SLOT2))== 1); {
                   // Serial.println ("  ENCE2 ");
                   }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,0);
                     lcd.print("ENCE");
               }

               // zona 3

               if((mOutput(RELE_SLOT3))== 0) { 
                     if((mOutput(RELE_SLOT3))== 0);{
                    // Serial.println ("  APAG3 ");
                    }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(12,0);
                     lcd.print("APAG");
 
               }
                          
               else{
                    if((mOutput(RELE_SLOT3))== 1); {
                    // Serial.println ("  ENCE3 ");
                    }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(12,0);
                     lcd.print("ENCE");
               }

               // zona 4

               if((mOutput(RELE_SLOT4))== 0) { // slot 14
                     if((mOutput(RELE_SLOT4))== 0);{
                     // Serial.println ("  APAG4 ");
                     }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,1);
                     lcd.print("APAG");
               }
                          
               else{
                    if((mOutput(RELE_SLOT4))== 1); {
                    // Serial.println ("  ENCE4 ");
                    }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(0,1);
                     lcd.print("ENCE");
               }

               // zona 5

               if((mOutput(RELE_SLOT5))== 0) { 
                     if((mOutput(RELE_SLOT5))== 0);{
                   //  Serial.println ("  APAG5 ");
                   }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,1);
                     lcd.print("APAG");
 
               }
                          
               else{
                    if((mOutput(RELE_SLOT5))== 1); {
                   // Serial.println ("  ENCE5 ");
                   }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(6,1);
                     lcd.print("ENCE");
               }
               
               // zona 6

               if((mOutput(RELE_SLOT6))== 0) { // slot 14
                     if((mOutput(RELE_SLOT6))== 0);{
                   //  Serial.println ("  APAG6 ");
                   }
                     // Cursor en la primera posición de la primera fila
                     lcd.setCursor(12,1);
                     lcd.print("APAG");
               }
                          
               else{
                    if((mOutput(RELE_SLOT6))== 1); {
                   // Serial.println ("  ENCE6 ");
                   }
                    // Cursor en la primera posición de la primera fila
                     lcd.setCursor(12,1);
                     lcd.print("ENCE");
               }
            
            
               
 
    }  
            FAST_PeerComms();
            START_PeerJoin();
    }
        EXECUTESLOW() {
            UPDATESLOW();
            SLOW_PeerJoin();
     }          
}

I have removed everything from the static ip in case it was that but it seems nothing, please look at it if you see what is failing

a greeting

Enrique Hurtado

unread,
Jun 27, 2019, 5:22:39 PM6/27/19
to souliss
Hi, can you paste the last code you used?

It seems that you forgot to translate the last comment.
Regards, Enrique.

Miguel Angel de Pablo

unread,
Jun 28, 2019, 2:48:50 AM6/28/19
to souliss
Hello, the last code that I used is in the message above, in which it has the header in Spanish :)

Enrique Hurtado

unread,
Jun 28, 2019, 4:37:38 AM6/28/19
to souliss

try whith theese changes ...

gateway

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

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/SuperNode.h"                   // The main node is the Gateway, we have just one node
#include "conf/usart.h"                      // USART 
#include "conf/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID             
#define WiFi_Password     


// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

// define ip fija 
//########################
uint8_t ip_address[4]  = {192, 168, 1, 50}; 
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 1, 1};
#define myvNet_address  ip_address[3]  
#define myvNet_subnet   0xFF00
- mostrar texto citado -
   SetAddress(0xD001, 0xFF00, 0x0000);

  //Nodos 
  
  SetAsPeerNode(0xAB02, 1); // luces valla
  SetAsPeerNode(0xAB03, 2); // riego
  SetAsPeerNode(0xAB04, 3); // luces terraza
  SetAsPeerNode(0xAB05, 4); // casa
  SetAsPeerNode(0xAB06, 5); // luces esquina norte
  SetAsPeerNode(0xAB07, 6); // caseta grande
  SetAsPeerNode(0xAB08, 7); // caseta pequeña
  SetAsPeerNode(0xAB09, 8); // luces esquina sur
  SetAsPeerNode(0xAB0A, 9); // piscina
  //SetAsPeerNode(0xAB0B, 10); // puerta atras
- mostrar texto citado -

Bridge

#include "conf/DynamicAddressing.h"
// Define the WiFi name and password
#define WIFICONF_INSKETCH
#define WiFi_SSID             
#define WiFi_Password     

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include "Souliss.h"

void setup()
{   
    Initialize();

    // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                           

    // This is the vNet address for this node, used to communicate with other
    // nodes in your Souliss network
    SetAddress(0xAB0B, 0xFF00, 0xAB01);
    SetAddress(0xD001, 0xFF00, 0x0000);
}

void loop()
{
   

    FAST_BridgeComms();
}

Peer

- mostrar texto citado -

Miguel Angel de Pablo

unread,
Jun 28, 2019, 11:07:53 AM6/28/19
to souliss
nothing....

Enrique Hurtado

unread,
Jun 30, 2019, 2:42:50 PM6/30/19
to souliss
Hi, could it be that you have connected something wrong, , but I can not help you because I do not know, I have esp12, esp01. Sorry...
May be  someone with more experience that me can help you
Reply all
Reply to author
Forward
0 new messages