French librairie in/out pour wago 740-841

alan1968

Active Member
Licensed User
Longtime User
je viens de faire une librairie "WAGO_B4A" pour B4A pour communiquer avec le wago 740-841 je gere les entrées et sortie digitale pour le moment en lectue/ecriture

si cela intéresse quelqu'un faite moi signe

voici une démonstration vidéo

Wago 750-841 sous android - YouTube
Wago 750-841 sous androide - YouTube

voici le code de la deuxième vidéo

'Activity module
Sub Process_Globals
Dim adr_ip As Double
Dim my_wago As MODBUS_TCP_MASTER_B4A
Dim timer1 As Timer

End Sub

Sub Globals
Dim Input_1 As CheckBox
Dim Input_2 As CheckBox
Dim label1 As Label
Dim etat_1,etat_2,etat_3,etat_4,etat_5,etat_6,etat_7,etat_8,etat_9,etat_10 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim x As String
If FirstTime Then
Timer1.Initialize("timer1", 500)
timer1.Enabled = True
Activity.LoadLayout("1")
my_wago.Ip("192.168.2.50")
my_wago.Connection
End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub timer1_Tick
Dim x As String
Dim i As Boolean
Dim b As String
Try
Input_1.IsInitialized
Input_2.IsInitialized
x=my_wago.ReadInput(512,16) '16 bits de sortie lus
label1.Text=x

'lampes temoins
If x.CharAt(7)=1 Then
etat_1.Color=Colors.Green
Else
etat_1.Color=Colors.LightGray
End If
If x.CharAt(6)=1 Then
etat_2.Color=Colors.Green
Else
etat_2.Color=Colors.LightGray
End If
If x.CharAt(5)=1 Then
etat_3.Color=Colors.Green
Else
etat_3.Color=Colors.LightGray
End If
If x.CharAt(4)=1 Then
etat_4.Color=Colors.Green
Else
etat_4.Color=Colors.LightGray
End If
If x.CharAt(3)=1 Then
etat_5.Color=Colors.Green
Else
etat_5.Color=Colors.LightGray
End If
If x.CharAt(2)=1 Then
etat_6.Color=Colors.Green
Else
etat_6.Color=Colors.LightGray
End If
If x.CharAt(1)=1 Then
etat_7.Color=Colors.Green
Else
etat_7.Color=Colors.LightGray
End If
If x.CharAt(0)=1 Then
etat_8.Color=Colors.Green
Else
etat_8.Color=Colors.LightGray
End If
If x.CharAt(16)=1 Then
etat_9.Color=Colors.Green
Else
etat_9.Color=Colors.LightGray
End If
If x.CharAt(15)=1 Then
etat_10.Color=Colors.Green
Else
etat_10.Color=Colors.LightGray
End If
Catch
End Try
End Sub

'bouttons on
Sub Button_on1_Up
my_wago.WriteOutput(0,True)
End Sub
Sub Button_on2_Up
my_wago.WriteOutput(1,True)
End Sub
Sub Button_on3_Up
my_wago.WriteOutput(2,True)
End Sub
Sub Button_on4_Up
my_wago.WriteOutput(3,True)
End Sub
Sub Button_on5_Up
my_wago.WriteOutput(4,True)
End Sub
Sub Button_on6_Up
my_wago.WriteOutput(5,True)
End Sub
Sub Button_on7_Up
my_wago.WriteOutput(6,True)
End Sub
Sub Button_on8_Up
my_wago.WriteOutput(7,True)
End Sub
Sub Button_on9_Up
my_wago.WriteOutput(8,True)
End Sub
Sub Button_on10_Up
my_wago.WriteOutput(9,True)
End Sub

'bouttons off
Sub Button_off1_Up
my_wago.WriteOutput(0,False)
End Sub
Sub Button_off2_Up
my_wago.WriteOutput(1,False)
End Sub
Sub Button_off3_Up
my_wago.WriteOutput(2,False)
End Sub
Sub Button_off4_Up
my_wago.WriteOutput(3,False)
End Sub
Sub Button_off5_Up
my_wago.WriteOutput(4,False)
End Sub
Sub Button_off6_Up
my_wago.WriteOutput(5,False)
End Sub
Sub Button_off7_Up
my_wago.WriteOutput(6,False)
End Sub
Sub Button_off8_Up
my_wago.WriteOutput(7,False)
End Sub
Sub Button_off9_Up
my_wago.WriteOutput(8,False)
End Sub
Sub Button_off10_Up
my_wago.WriteOutput(9,False)
End Sub
 
Last edited:

ciprian

Active Member
Licensed User
Longtime User
Bonjour

Je suis intéresse par votre librairie, et également par votre exemple d'application.
Joli travail...c'est intéressant et j'aimerais vous remercier pour votre partage.
Cordialement.:sign0098:
 
Top