-->
Page 1 of 1

Simple Script at start i need 3 times to blink a External LE

PostPosted: Sun Jan 14, 2018 10:33 am
by accloginsell
Hi all,



just need a simple script
Once NODEMCU receive power it should power one GPIO 3 Times with a little hold of 1 Second between

can you help me whats wrong with this?

After flashing nothing is working
Code: Select all#define LED 4
void setup() {
  // put your setup code here, to run once:
 pinMode(LED, OUTPUT); // Port aus Ausgang schalten
 delay(3000); //1 Sek Pause
 digitalWrite(LED, LOW); //Led port ausschalten
 delay(300); //1 Sek Pause
 digitalWrite(LED, HIGH); //Led port einschlaten
 delay(1000);
 digitalWrite(LED, LOW); //Led port ausschalten
 delay(300); //1 Sek Pause
 digitalWrite(LED, HIGH); //Led port einschlaten
 delay(1000);
 digitalWrite(LED, LOW); //Led port ausschalten
 delay(300); //1 Sek Pause
 digitalWrite(LED, HIGH); //Led port einschlaten
}

void loop() {
  // put your main code here, to run repeatedly:

}


Thanks for your help!!

Nico

Re: Simple Script at start i need 3 times to blink a Externa

PostPosted: Mon Jan 15, 2018 7:59 am
by schufti
Hi,
if you want to toggle gpio3 why do you define LED as 4?
And you wouldn't want to toggle gpio3 (uart RX).

you wouldn't need the first delay(1000) after defining pin as output ... it just gives you a delay where nothing happens.

take care that on nodemcu gpio <> pinname (see attached graphic).
you can use Dx pinnames when you set your board to nodemcu, but not otherway round (use Dx when set to generic ESP). Best is to allways use plain (gpio-) number.