mod sketch - Hello World." need "ON" button, which activates the 5-pin for 5 seconds.

102 views
Skip to first unread message

Roman Solotoy

unread,
May 12, 2016, 1:40:09 PM5/12/16
to souliss
You can change the code so that when you press the "ON" button souliss app,

" OUTPUT PIN 5" was active only 5 seconds, and again switched off.

need "ON" button, which activates the 5-pin for 5 seconds.
if possible...


If such questions generate undesirable, please write.
sorry for my English and

Thank you

/**************************************************************************
    Souliss - Hello World for Expressif ESP8266
   
    This is the basic example, create a software push-button on Android
    using SoulissApp (get it from Play Store). 
   
    Load this code on ESP8266 board using the porting of the Arduino core
    for this platform.
       
***************************************************************************/

// 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/IPBroadcast.h"

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

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

/*** All configuration includes should be above this line ***/
#include "Souliss.h"

// This identify the number of the LED logic
#define MYLEDLOGIC          0              

// **** Define here the right pin for your ESP module ****
#define    OUTPUTPIN            5

void setup()
{  
    Initialize();

    // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                          
    SetAsGateway(myvNet_dhcp);       // 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);
    SetAsPeerNode(0xAB02, 1);
   
    Set_SimpleLight(MYLEDLOGIC);        // Define a simple LED light logic
   
    pinMode(OUTPUTPIN, OUTPUT);         // Use pin as output
}

void loop()
{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC);
            LowDigOut(OUTPUTPIN, Souliss_T1n_Coil,MYLEDLOGIC);
        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                       
    }
}

Antonino Fazio

unread,
May 13, 2016, 1:10:09 PM5/13/16
to souliss

Roman Solotoy

unread,
May 13, 2016, 7:13:22 PM5/13/16
to souliss
Thanks you,
I am not able to make programs
I have no ideas how to collect logic sketch of T14 Typical 14 : Pulse Digital Output.
I look for opportunities to make it in a network.


so far I have made only it:
 it turns off sockets and the light my home through a mobile network and wi-fi :)
I use  "ESP8266 NodeMcu V2 Lua WIFI"


/**************************************************************************
    Souliss - Hello World for Expressif ESP8266
   
    This is the basic example, create a software push-button on Android
    using SoulissApp (get it from Play Store). 
   
    Load this code on ESP8266 board using the porting of the Arduino core
    for this platform.
       
***************************************************************************/

// 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/IPBroadcast.h"

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


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

/*** All configuration includes should be above this line ***/
#include "Souliss.h"

// This identify the number of the LED logic
#define MYLEDLOGIC          1   
#define MYLEDLOGIC2         2
#define MYLEDLOGIC3         3          
#define MYLEDLOGIC4         4   
#define MYLEDLOGIC5         5
#define MYLEDLOGIC6         6         
#define MYLEDLOGIC7         7   
#define MYLEDLOGIC8         8

// **** Define here the right pin for your ESP module ****
#define    OUTPUTPIN        0
#define    OUTPUTPIN2       5
#define    OUTPUTPIN3       4
#define    OUTPUTPIN4       16
#define    OUTPUTPIN5       2
#define    OUTPUTPIN6       14
#define    OUTPUTPIN7       13
#define    OUTPUTPIN8       3


void setup()
{  
    Initialize();

    // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                          
    SetAsGateway(myvNet_dhcp);       // 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);
 
   
    Set_SimpleLight(MYLEDLOGIC);        // Define a simple LED light logic
    Set_SimpleLight(MYLEDLOGIC2);
    Set_SimpleLight(MYLEDLOGIC3);
    Set_SimpleLight(MYLEDLOGIC4);        // Define a simple LED light logic
    Set_SimpleLight(MYLEDLOGIC5);
    Set_SimpleLight(MYLEDLOGIC6);
    Set_SimpleLight(MYLEDLOGIC7);        // Define a simple LED light logic
    Set_SimpleLight(MYLEDLOGIC8);

   
    pinMode(OUTPUTPIN, OUTPUT);         // Use pin as output #
    pinMode(OUTPUTPIN2, OUTPUT);
    pinMode(OUTPUTPIN3, OUTPUT);
    pinMode(OUTPUTPIN4, OUTPUT);         // Use pin as output #
    pinMode(OUTPUTPIN5, OUTPUT);
    pinMode(OUTPUTPIN6, OUTPUT);
    pinMode(OUTPUTPIN7, OUTPUT);         // Use pin as output #
    pinMode(OUTPUTPIN8, OUTPUT);



}

void loop()
{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC);
            LowDigOut(OUTPUTPIN, Souliss_T1n_Coil,MYLEDLOGIC);

        // Here we handle here the communication with Android
        FAST_GatewayComms();
                                  
    }

 }
 
{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_10ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC2);
            LowDigOut(OUTPUTPIN2, Souliss_T1n_Coil,MYLEDLOGIC2);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                       
    }
}


{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC3);
            LowDigOut(OUTPUTPIN3, Souliss_T1n_Coil,MYLEDLOGIC3);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                       
    }
}
  {
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC4);
            LowDigOut(OUTPUTPIN4, Souliss_T1n_Coil,MYLEDLOGIC4);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                       
    }
}

{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC5);
            LowDigOut(OUTPUTPIN5, Souliss_T1n_Coil,MYLEDLOGIC5);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                       
    }
}


{
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC6);
            LowDigOut(OUTPUTPIN6, Souliss_T1n_Coil,MYLEDLOGIC6);

        }
             
 }
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC7);
            LowDigOut(OUTPUTPIN7, Souliss_T1n_Coil,MYLEDLOGIC7);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();
        { 
}

    {
 {
  {

 }
    // Here we start to play
    EXECUTEFAST() {                    
        UPDATEFAST();  
       
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            Logic_SimpleLight(MYLEDLOGIC8);
            LowDigOut(OUTPUTPIN8, Souliss_T1n_Coil,MYLEDLOGIC8);

        }
             
        // Here we handle here the communication with Android
        FAST_GatewayComms();
        {                                       
    }
}

}
}
}
}
}




пятница, 13 мая 2016 г., 19:10:09 UTC+2 пользователь Antonino Fazio написал:

ymis

unread,
May 15, 2016, 3:14:34 AM5/15/16
to souliss
A simple approach is this.  I wrote it in purpose to activate a relay for a given time. Read it carefully and then read Dario Di Maio's answer
https://groups.google.com/forum/#!topic/souliss/hmnCA3Kg6Ho
 At the sketch's declarations  you will find the variable myPulseLimit   Set myPulseLimit=5000 and you will have a relay active for 5 seconds

Roman Solotoy

unread,
May 15, 2016, 1:33:23 PM5/15/16
to souliss
I'm a little edited your code...
and it works the way I want.
much obliged to you.
thank you
.


code:


// 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/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "name wi-fi"
#define WiFi_Password           "12345678"


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

/*** All configuration includes should be above this line ***/
#include "Souliss.h"







#define GateDoor   0

#define    OUTPUTPIN3      0
#define    INPUTPIN2       5



long myCounter1=0;
long myPulseLimit=1500;


void setup()

    Initialize();


  // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                         
    SetAsGateway(myvNet_dhcp);       // 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);
 



   
    
    Set_T14(GateDoor);                    // Define a simple  logic ----Set_T18 for feedback logik
 
    pinMode(INPUTPIN2, INPUT);                
    pinMode(OUTPUTPIN3, OUTPUT);             
  
}
void loop()
{
    EXECUTEFAST() {
                    
        UPDATEFAST(); 
     
        FAST_50ms()
        {            
                 
           // GateDoor
            DigOut(INPUTPIN2, Souliss_T1n_ToggleCmd, GateDoor);                
          
            Logic_T11(GateDoor);
                      
            LowDigOut (OUTPUTPIN3, Souliss_T1n_OnCoil, GateDoor);                    //If logic GateDoor is High then set pin3 High to start the pulse
          
            if((mOutput(GateDoor) == Souliss_T1n_OnCoil))              // if i have a pulse start timer counter
            {
                 myCounter1=myCounter1+50;                                  //increase counter
             
                if(myCounter1>myPulseLimit)                                  //   if timer is greater than my limit            
                {
                    mInput(GateDoor)=Souliss_T1n_ToggleCmd;        // send a Toggle command
                    Logic_T11(GateDoor);
                    LowDigOut(OUTPUTPIN3, Souliss_T1n_OffCoil, GateDoor);         // set output to Low
                    myCounter1=0;                                                      //when pulse stops,  reset counter
               } //end if
           } // end if} // end FAST_50ms()
            
      
        FAST_GatewayComms();                                      
      
    }
 
}
}



воскресенье, 15 мая 2016 г., 9:14:34 UTC+2 пользователь ymis написал:
Reply all
Reply to author
Forward
0 new messages