B4R Question Access Point

JMB

Active Member
Licensed User
Longtime User
Are all ESP8266 chips the same?

I've been using a Wemos Lolin Node MCU board with an ESP8266, and now I am using a sort of generic ESP8266 ESP-01 board which seems to work when I set the Board Type to ESPino (ESP-12 Module).

At least, I can get the blue LED flashing on the board, so I sort of know it's working. However, when I try and use
B4X:
 Wifi.StartAccessPoint("TEST_AP")
no wifi network appears.

Any clues would be most appreciated.

JMB
 

JMB

Active Member
Licensed User
Longtime User
It's a bit weird. The code works fine - but I don't get any log messages coming back to the console. And I have to unplug and plug it in again every time I want to program it. Not particularly helpful when developing!

I tried to run a program activating the Wifi using the Arduino compiler - and the Access point that I had defined in the B4X code came on! ??????????????
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
This code runs under Arduino...
B4X:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

/*
ESP8266 Blink
Blink the blue LED on the ESP8266 module
*/

#define LED 1 //Define blinking LED pin

void setup() {
Serial.begin(115200);
 Serial.println();
 Serial.println("Hello World");

 
  pinMode(LED, OUTPUT); // Initialize the LED pin as an output
 // Serial.print("write this");
  WiFi.mode(WIFI_AP);
  WiFi.softAP("THE_TEST");
}
// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED, LOW); // Turn the LED on (Note that LOW is the voltage level)
  delay(1000); // Wait for a second
  digitalWrite(LED, HIGH); // Turn the LED off by making the voltage HIGH
  delay(1000); // Wait for two seconds
}

None of the log messages get sent back to the terminal, but the Access Point starts up.

But this B4R code:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public Serial1 As Serial
   
    Private Blue_LED_Timer As Timer
    Private Blue_LED_Pin As Pin
    Private Blue_LED_state As Boolean
   
    'Provides access to the Wifi controller on the ESP device
    Public ESPWiFi As ESP8266WiFi
   
    Private const LED_Flash_Rate_When_ESP_AP_Active As Int = 200
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Log("hello")
   

    Blue_LED_Pin.Initialize(1,Blue_LED_Pin.MODE_OUTPUT)
    Blue_LED_state = False
   
    Blue_LED_Timer.Initialize("BlueLEDTimerTick",1000)
    ESPWiFi.StartAccessPoint("TINY_AP1")
    Blue_LED_Timer.Interval = LED_Flash_Rate_When_ESP_AP_Active
    Blue_LED_Timer.Enabled = True
End Sub

Private Sub BlueLEDTimerTick
    Blue_LED_Pin.DigitalWrite(Blue_LED_state)
    Blue_LED_state = Not(Blue_LED_state)
End Sub

makes the LED flash but no Access Point.

And neither pieces of code send Log or console messages back.

JMB
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Thanks Erel. I have little data on these boards. I will continue to investigate.

JB
 
Upvote 0
Top