Sonoff BASIC gpio13

Hi

How can i define in platformio.ini the following parameters ?

In arduino the applications runs, i can power on and off the led, but no executes on platformio.

Thanks!

Reference:

Hi!

Look for this examples: Tasmota/platformio.ini at development · arendst/Tasmota · GitHub

Here you can see more details: Redirecting...

Best regards.

1 Like

[env:esp01_1m]
platform = espressif8266
framework = arduino
board_build.flash_mode = dout
board_build.f_cpu = 80000000L
board_build.f_flash = 40000000L
upload_resetmethod = ck
board = esp01_1m
build_flags = -DMQTT_MAX_PACKET_SIZE=1500
build_flags = -Teagle.flash.1m64.ld
upload_speed = 115200
upload_port = COM21
build_unflags = -Wall

I try this, but the example

int relePin = 13; //DECLARAÇÃO DE VARIÁVEL DO TIPO INTEIRA(VARIÁVEL CORRESPONDENTE AO GPIO 12 DO ESP8266)

void setup() {

pinMode(relePin, OUTPUT); //DEFINE QUE O PINO É UMA SAÍDA
while(1)
{ digitalWrite(relePin, HIGH); //RELÉ INICIA DESLIGADO
delay(1000);
digitalWrite(relePin, LOW); //RELÉ INICIA DESLIGADO
delay(1000);
}
}

void loop()
{
}

Only works on Arduino, not on Platformio

http://docs.platformio.org/en/latest/platforms/espressif8266.html

I see that, but what am i doing wrong in the config .ini ?

Using this settings you can upload the code?

If yes, you should add some debug message on loop to see what happens.

Also this is not the best way to work with Arduino code because the loop should be used for this.

while(1)
{ 
  digitalWrite(relePin, HIGH); //RELÉ INICIA DESLIGADO
  delay(1000);
  digitalWrite(relePin, LOW); //RELÉ INICIA DESLIGADO
  delay(1000);
}

Try:

const int relePin = 13;

void setup() 
{
  Serial.begin(9600);
  pinMode(relePin, OUTPUT); 
}

void loop()
{
  digitalWrite(relePin, HIGH); // Desliga o relê
  Serial.println("Rele desligado");
  delay(1000);

  digitalWrite(relePin, LOW); // Liga o relê
  Serial.println("Rele ligado");
  delay(1000);
}

Solved. But very strange!

I have to config the pinMode(pin, 1) to make it output to works!