B4R Question ESP-01 pinout

GiG

Member
Hi All,

I'm using ESP01 board, please can some one tell me the number of PIN that I have to use for GPIO_0 and GPIO_2 of this board?

Thank you
GiG
 

woniol

Active Member
Licensed User
Longtime User
Hi,
please try this:
- add rESP8266 library to your project
- add D1Pins to Process_Globals
B4X:
Private dp As D1Pins
- use dp in your code like this:
B4X:
ledPin.Initialize(dp.D0, ledPin.MODE_OUTPUT)
 
Upvote 0

GiG

Member
Hi,
so could be like this?

In global:
B4X:
Private dp As D1Pins
Private bt as D1Pins

In code:
B4X:
ledPin.Initialize(dp.D0, ledPin.MODE_OUTPUT) ' --> this for GPIO_0
buttonPin.Initialize(bt.D2, buttonPin.MODE_INPUT) ' --> this for GPIO_2

But I have a dubt:
I have to declare buttonPin and ledPin, how?

Thank you
 
Upvote 0

woniol

Active Member
Licensed User
Longtime User
Hi,
You can declare it once:
B4X:
Private dp As D1Pins

and use it for all pins initialization:
B4X:
ledPin.Initialize(dp.D0, ledPin.MODE_OUTPUT) ' --> this for GPIO_0
buttonPin.Initialize(dp.D2, buttonPin.MODE_INPUT) ' --> this for GPIO_2

Just give it a try if it works with your board.
 
Upvote 0

GiG

Member
Hi,

I need to declare buttonPin but it's non working, GPIO_0 is all time a 0 even when I connect it to VCC

B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Private Timer1 As Timer
    Private dp As D1Pins
    Dim buttonPin As Pin

End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    buttonPin.Initialize(dp.D0, buttonPin.MODE_INPUT_PULLUP) ' --> this for GPIO_0
    Timer1.Initialize("Timer1_Tick", 1000) '1000ms = 1 second
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick
    Log("Timer1_Tick")
    Log ("buttonPin=" , buttonPin.DigitalRead)
End Sub

Any idea?

Thank you
 
Last edited:
Upvote 0

GiG

Member
Hi All,

I founded the correct settings traying pins one by one, at the end I discovered this:

for GPIO_0 --> dp.D4
for GPIO_2 --> dp.D3

Thank you for all to help me!! Hi hope it could be helpfull also for other.

Now I will move to deepsleep and web client, my final target is a connection with IFTTT.

If needed I will ask you more in a new tread.

Thank you again for helping me!! :)

GiG
 
Upvote 0
Top