B4R Question pins not changed on Wemos_d1r2 / ESP8266

Tayfur

Well-Known Member
Licensed User
Longtime User
My first code desnt work;
each 5 sec, all pins changed with timer.
I cheked with voltmeter(DC)
I touched Wemos D4 and GND pins.
After I seen 3.3volt on voltmeter.
but never change with each evet of timer.

I cant work with hardware of WEMOS D2R2

Notes : i tried
pinLED1.Initialize("D1", pinLED1.MODE_OUTPUT)
and
pinLED1.Initialize(1, pinLED1.MODE_OUTPUT)



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
    
  
   Public pinLED1 As Pin
   Public pinLED2 As Pin
   Public pinLED3 As Pin
   Public pinLED4 As Pin
   Public pinLED5 As Pin
   Public pinLED6 As Pin
 
  
   Public LightOn As Boolean
   Public timer1 As Timer
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    Log("ledsss")
    pinLED1.Initialize("D1", pinLED1.MODE_OUTPUT)
    pinLED2.Initialize("D2", pinLED2.MODE_OUTPUT)
    pinLED1.Initialize("D3", pinLED1.MODE_OUTPUT)
    pinLED4.Initialize("D4", pinLED4.MODE_OUTPUT)
    pinLED5.Initialize("D5", pinLED5.MODE_OUTPUT)
    pinLED6.Initialize("D6", pinLED6.MODE_OUTPUT)
    LightOn=True   
    pinLED1.DigitalWrite(True)
    pinLED2.DigitalWrite(True)
    pinLED3.DigitalWrite(True)
    pinLED4.DigitalWrite(True)
    pinLED5.DigitalWrite(True)
    pinLED6.DigitalWrite(True)
    Log("starts")
timer1.Initialize("timer1_tick",5000)
timer1.Enabled=True


End Sub

Sub timer1_tick
   
    If LightOn=True Then LightOn=False Else LightOn=True
   
    pinLED1.DigitalWrite(LightOn)
    pinLED2.DigitalWrite(LightOn)
    pinLED3.DigitalWrite(LightOn)
    pinLED4.DigitalWrite(LightOn)
    pinLED5.DigitalWrite(LightOn)
    pinLED6.DigitalWrite(LightOn)
   
    Log("Led durum >>: ",LightOn)
End Sub
 

rbghongade

Active Member
Licensed User
Longtime User
Please add :
B4X:
Private wemos As D1Pins ' in process globals

pinLED1.Initialize(wemos.D1, pinLED1.MODE_OUTPUT) ' in AppStart
.
.
.
and check!
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Please add :
B4X:
Private wemos As D1Pins ' in process globals

pinLED1.Initialize(wemos.D1, pinLED1.MODE_OUTPUT) ' in AppStart
.
.
.
and check!
thank you very very much...:):):):)

I added lib eESP8266 and i used your way.
its perfect now.

Thank you again
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Please add :
B4X:
Private wemos As D1Pins ' in process globals

pinLED1.Initialize(wemos.D1, pinLED1.MODE_OUTPUT) ' in AppStart
.
.
.
and check!

Hello again @rbghongade ;

I tested your way for input control/buton

But; dosent work it.
Pins stated never change????

B4X:
App start...
Private Sub AppStart
    Serial1.Initialize(115200)
pinButon.Initialize(wemos.D3,pinButon.MODE_INPUT_PULLUP)
    pinButon.AddListener("Pin_okundu")
timer1.Initialize("timer1_tick",2000)
timer1.Enabled=True
'//-----------
end sub


Sub Pin_okundu (State As Boolean)
Log("Pin State: ", State)
'state will be False when the button is clicked because of the PULLUP mode.
If State Then
     timer1.Enabled=False
    timer1.Interval=1000
    timer1.Enabled=True
Else
    timer1.Enabled=False
    timer1.Interval=5000
    timer1.Enabled=True
End If
End Sub
 
Upvote 0

rbghongade

Active Member
Licensed User
Longtime User
Use:
pinButon.MODE_INPUT instead of pinButon.MODE_INPUT_PULLUP
Of course it depends on how you have connected the button.
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Use:
pinButon.MODE_INPUT instead of pinButon.MODE_INPUT_PULLUP
Of course it depends on how you have connected the button.

I solved;
I conneceted 3v3 pin to D3 PIN;
it's wrog;

I must to connect GND to D3 Pin


Thank you for helps
 
Upvote 0
Top