Led Blink for a sign of node is running

155 views
Skip to first unread message

Lesjaw Ardi™ ♂

unread,
Jun 29, 2015, 12:46:33 PM6/29/15
to sou...@googlegroups.com
Helo..

I am planning to put a simple Led Blink in every node for a sign that the node is running..

can i put the code outside of the phase? or it should in any phase?

void loop(){
            // Here we start to play
            EXECUTEFAST() {                     
                UPDATEFAST();   
                
                FAST_510ms()
                {
                   // Retreive data from the MaCaco communication channel
                Souliss_CommunicationData(memory_map, &data_changed);
               
                // Compare the acquired input with the stored one, send the new value to the
                // user interface if the difference is greater than the deadband
       
                Souliss_Logic_T52(memory_map, TEMPERATURE, DEADBAND, &data_changed);
                Souliss_Logic_T53(memory_map, HUMIDITY, DEADBAND, &data_changed);
                 
                   
                }
                      
                // Here we handle here the communication with Android
                FAST_GatewayComms(); 
                // Execute the code every 2110ms          
                FAST_2110ms()   { 
             
              // Input from anti-theft sensor
                LowDigIn(2, Souliss_T4n_Alarm, ANTITHEFT);
                   
                // Execute the anti-theft logic
                Logic_T41(ANTITHEFT);  
                
                // Build a watchdog chain to monitor the nodes
                mInput(ANTITHEFT) = Watchdog(0xAB02, WATCHDOG, Souliss_T4n_Alarm);                
                }
         }
         
         EXECUTESLOW() {
         UPDATESLOW();
                       
         SLOW_10s() {  
             // Read temperature value from DHT sensor and convert from single-precision to half-precision
                    float temperature = dht.readTemperature();
                    
                    Souliss_ImportAnalog(memory_map, TEMPERATURE, &temperature);
                    //Serial.print ("Temp  ");
                    //Serial.print (dht.readTemperature());                    
                    // Read humidity value from DHT sensor and convert from single-precision to half-precision
                    float humidity = dht.readHumidity();
                    
                    Souliss_ImportAnalog(memory_map, HUMIDITY, &humidity);
                    //Serial.print (" & Hum  ");    
                    //Serial.println (dht.readHumidity());
            
            digitalWrite(BLINK, HIGH);
            delay(500); 
            digitalWrite(BLINK, LOW);
            delay(500);    
          } 
    }
  
}


or :

void loop(){
            // Here we start to play
            EXECUTEFAST() {                     
                UPDATEFAST();   
                
                FAST_510ms()
                {
                   // Retreive data from the MaCaco communication channel
                Souliss_CommunicationData(memory_map, &data_changed);
               
                // Compare the acquired input with the stored one, send the new value to the
                // user interface if the difference is greater than the deadband
       
                Souliss_Logic_T52(memory_map, TEMPERATURE, DEADBAND, &data_changed);
                Souliss_Logic_T53(memory_map, HUMIDITY, DEADBAND, &data_changed);
                 
                   
                }
                      
                // Here we handle here the communication with Android
                FAST_GatewayComms(); 
                // Execute the code every 2110ms          
                FAST_2110ms()   { 
             
              // Input from anti-theft sensor
                LowDigIn(2, Souliss_T4n_Alarm, ANTITHEFT);
                   
                // Execute the anti-theft logic
                Logic_T41(ANTITHEFT);  
                
                // Build a watchdog chain to monitor the nodes
                mInput(ANTITHEFT) = Watchdog(0xAB02, WATCHDOG, Souliss_T4n_Alarm);                
                }
         }
         
         EXECUTESLOW() {
         UPDATESLOW();
                       
         SLOW_10s() {  
             // Read temperature value from DHT sensor and convert from single-precision to half-precision
                    float temperature = dht.readTemperature();
                    
                    Souliss_ImportAnalog(memory_map, TEMPERATURE, &temperature);
                    //Serial.print ("Temp  ");
                    //Serial.print (dht.readTemperature());                    
                    // Read humidity value from DHT sensor and convert from single-precision to half-precision
                    float humidity = dht.readHumidity();
                    
                    Souliss_ImportAnalog(memory_map, HUMIDITY, &humidity);
                    //Serial.print (" & Hum  ");    
                    //Serial.println (dht.readHumidity());
            
              
          } 
    }
            digitalWrite(BLINK, HIGH);
            delay(500); 
            digitalWrite(BLINK, LOW);
            delay(500);  
}


Juan Pinto

unread,
Jun 29, 2015, 1:00:22 PM6/29/15
to sou...@googlegroups.com
Don't use a delay! This is a bad way and the code stop working :P
 
If you want a blink every 500ms you can do this:
 
FAST_510ms() {
      digitalWrite(BLINK, !digitalRead(BLINK));
}
 
Regards

Lesjaw Ardi™ ♂

unread,
Jun 29, 2015, 1:03:38 PM6/29/15
to sou...@googlegroups.com
thanks again juan..yes..

--
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/032700cf-123c-49f4-a288-8557d51b08cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lesjaw Ardi™ ♂

unread,
Jun 30, 2015, 3:08:11 PM6/30/15
to sou...@googlegroups.com
hi juan..

rather then just make esp blink on running, i make it blink only when esp connected to wifi network..

the code :

FAST_50ms(){
                
              if (WiFi.status() == WL_CONNECTED) { 
                digitalWrite(BLINK, !digitalRead(BLINK));
               
              }
                }

since esp01 only have 2 gpio, so i use the gpio0, but i have trouble with some of esp..

some after i connected a led to gpio0, esp always stuck on boot mode/upload mode..i have tried to make gpio0 pullup by putting a 10k resistor to vcc (3.3v).. but it seems doesn't solve my problem...

if i disconnect the gpio0 cable then turn on the esp, it can boot normal mode, then i can connect the cable and see my led blink after esp get connected to wifi network..

any suggestion to make sure gpio0 and gpio2 always on HIGH during turn off?

Lesjaw Ardi™ ♂

unread,
Jun 30, 2015, 3:10:10 PM6/30/15
to sou...@googlegroups.com
i mean GPIO0 and 2 always HIGH after turn on..to make sure esp run on normal mode

Juan Pinto

unread,
Jun 30, 2015, 3:31:14 PM6/30/15
to sou...@googlegroups.com
Good tip to see if the node is connected to the WIFI I use and ESP12 module and the led on the module blinks when send's and receive data,  my problem was with GPIO15, if I put a PIR sensor when I power on the node the PIR starts at HIGH state and the node doesn't work, I changed my scheme and now I use GPIO15 to a TIP122 to control a Led strip and works ok. That what I can say for now :P
 
On ESP 12 this is needed to running only:
GPIO0    PullUp
GPIO15 PullDown
 
Regards.

Lesjaw Ardi™ ♂

unread,
Jun 30, 2015, 3:35:14 PM6/30/15
to sou...@googlegroups.com
yes juan..with esp12 we can choose any 9 of its gpio, but i have esp1.. only 2 gpio..

how do you make gpio0 pullup??

Juan Pinto

unread,
Jun 30, 2015, 3:45:33 PM6/30/15
to sou...@googlegroups.com
I don't do xD  just connect gpio0 to gnd to load the sketch and then let free, but here:
you can find this scheme, and the recommended scheme to improve stability:
 

Reset on my PCB is open too (not connected) and works well.

 
Regards

Lesjaw Ardi™ ♂

unread,
Jun 30, 2015, 4:05:49 PM6/30/15
to sou...@googlegroups.com
yes..that my setup...

i dont know why connecting a led to gpio0 make gpio0 pulldown

Lesjaw Ardi™ ♂

unread,
Jun 30, 2015, 8:38:46 PM6/30/15
to sou...@googlegroups.com
i switch the gpio, it seem i can't ever use gpio0 with led..

Juan Pinto

unread,
Jul 1, 2015, 9:35:48 AM7/1/15
to sou...@googlegroups.com
I'll use GPIO15 to Led and GPIO0 to pushbutton.
 
Regards.

Domenico Carvetta

unread,
Jul 1, 2015, 9:39:02 AM7/1/15
to sou...@googlegroups.com
HI both,
can you public the final sketch release with Led signing WiFi-connected, thanks ?
I would like to add to my sketchs.

Lesjaw Ardi™ ♂

unread,
Jul 1, 2015, 9:56:54 AM7/1/15
to sou...@googlegroups.com

I will post it tonight... After making a new board... I am etching a pcb right now.. Hehehe.... Making a simple esp12 board for dimmer 10 watt led white

--
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.

domenico carvetta

unread,
Jul 1, 2015, 9:57:54 AM7/1/15
to sou...@googlegroups.com
Oh thanks a lot !

Lesjaw Ardi™ ♂

unread,
Jul 2, 2015, 8:20:01 AM7/2/15
to sou...@googlegroups.com

Domenico... Sorry for the late post of my sketch... I am going to test juan sketch first... Testing WiFi manager...

On Jul 1, 2015 8:57 PM, "domenico carvetta" <carvetta...@gmail.com> wrote:
Oh thanks a lot !

--
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.

Domenico Carvetta

unread,
Jul 2, 2015, 8:52:39 AM7/2/15
to sou...@googlegroups.com
No problem, I stay on call...
Reply all
Reply to author
Forward
0 new messages