Sub Process_Globals
Public Serial1 As Serial
Public WiFi As ESP8266WiFi
Public esp As ESP8266
Private eeprom As EEPROM
Private const MAGIC_EEPROM As Byte = 123
Private bc As ByteConverter
Public ww As Boolean
Public Timers As Timer
Private wemos As D1Pins
Public Pin1 As Pin
Public Pin2 As Pin
Public Pin3 As Pin
Public Pin4 As Pin
Public Pin5 As Pin
Public Pin6 As Pin
Public Pin7 As Pin
Public P1 As Boolean
Public P2 As Boolean
Public P3 As Boolean
Public P4 As Boolean
Public P4_EX As Boolean
Public P5 As Boolean
Public P6 As Boolean
Public P7 As Boolean
Public durum As String
Public sayac As Int
End Sub
Private Sub PIN1_Changed (State As Boolean)
'Log("1--*********pin1 changed",State)
P1=State
pinler(True)
End Sub
Private Sub PIN2_Changed (State As Boolean)
'Log("2--*********pin2 changed",State)
P2=State
pinler(True)
End Sub
Private Sub PIN7_Changed (State As Boolean)
'Log("7--*********pin7 changed",State)
P7=State
pinler(True)
End Sub
'ön kapı
Private Sub PIN3_Changed (State As Boolean)
'Log("3--*********pin3 changed",State)
P3=State
pinler(True)
End Sub
'home poziyon
Private Sub PIN4_Changed (State As Boolean)
'Log("4--*********pin4 changed",State)
P4=State
pinler(True)
Return
If P4<>State Then
'P4=State
P4=State
If P3=True And P5=False And P6=False Then
'sistem otomatikte
sayac=sayac+1
End If
End If
End Sub
'Motor
Private Sub PIN5_Changed (State As Boolean)
'Log("5 --*********pin5 changed",State)
P5=State
pinler(True)
End Sub
'yesiş lamba
Private Sub PIN6_Changed (State As Boolean)
'Log("6--*********pin6 changed",State)
P6=State
pinler(True)
End Sub
Private Sub pinler(x As Boolean)
If x Then
Log(P1,"-",P2,"-",P3,"-",P4,"-",P5,"-",P6,"-",P7," ",Rnd(11,99))',"-",P1,"-",P1,"-",
Else
Log(P1,"-",P2,"-",P3,"-",P4,"-",P5,"-",P6,"-",P7," XXXXX ",Rnd(11,99))',"-",P1,"-",P1,"-",
End If
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
ww=True
Log("step1")
WiFiServer.Start
' Return
' Log("step2")
' ConnectToNetwork
P3=False
P4=False
P5=False
P6=False
P4_EX=False
sayac=0
Pin1.Initialize(wemos.D1,Pin1.MODE_INPUT_PULLUP)
Pin2.Initialize(wemos.D2,Pin2.MODE_INPUT_PULLUP)
Pin3.Initialize(wemos.D3,Pin3.MODE_INPUT_PULLUP)
Pin3.Initialize(wemos.D3,Pin3.MODE_INPUT_PULLUP)
Pin4.Initialize(wemos.D4,Pin4.MODE_INPUT_PULLUP)
Pin5.Initialize(wemos.D5,Pin5.MODE_INPUT_PULLUP)
Pin6.Initialize(wemos.D6,Pin6.MODE_INPUT_PULLUP)
Pin7.Initialize(wemos.D7,Pin7.MODE_INPUT_PULLUP)
P1=Pin1.DigitalRead
P2=Pin2.DigitalRead
P3=Pin3.DigitalRead
P4=Pin4.DigitalRead
P5=Pin5.DigitalRead
P6=Pin6.DigitalRead
P4_EX=P4
Pin1.AddListener("PIN1_Changed")
Pin2.AddListener("PIN2_Changed")
Pin3.AddListener("PIN3_Changed")
Pin4.AddListener("PIN4_Changed")
Pin5.AddListener("PIN5_Changed")
Pin6.AddListener("PIN6_Changed")
Pin7.AddListener("PIN7_Changed")
Timers.Initialize("T_tick",5000)
Timers.Enabled=True
End Sub
Private Sub PINx_Changed (State As Boolean)
'Log("5 --*********pin5 changed",State)
P1=Pin1.DigitalRead
P2=Pin2.DigitalRead
P3=Pin3.DigitalRead
P4=Pin4.DigitalRead
P5=Pin5.DigitalRead
P6=Pin6.DigitalRead
P7=Pin7.DigitalRead
pinler(True)
End Sub
private Sub T_Tick
'Log("Timers")
P1=Pin1.DigitalRead
P2=Pin2.DigitalRead
P3=Pin3.DigitalRead
P4=Pin4.DigitalRead
P5=Pin5.DigitalRead
P6=Pin6.DigitalRead
P7=Pin7.DigitalRead
pinler(False)
End Sub