Demande d'aide de code dans mon software

Résolu
filou220684 Messages postés 2 Date d'inscription mercredi 23 avril 2008 Statut Membre Dernière intervention 3 mai 2012 - 2 mai 2012 à 21:22
filou220684 Messages postés 2 Date d'inscription mercredi 23 avril 2008 Statut Membre Dernière intervention 3 mai 2012 - 3 mai 2012 à 18:32
bonjour a tous,je me présente, philippe,28 ans, électricien ...voila je suis en train de fabriquer une machine capable de faire pousser des plantes en intérieur en hydroponie.
pour ce projet je suis en train de crée une interface qui me permet de gérer automatiquement:

- le ph de l'eau
-l'ec (nutriment dans l'eau)
-la lumière
-l'intraction d'air
-l'extraction d'air
-la ventilation
-surveiller a distance a l'aide d'une camera

Pour ce projet, j'utilise électroniquement,

- 2 cartes Veleman k8055 qui dispose de
.10 entrées numériques
.4 entrées analogiques
.16 interrupteurs de sortie numériques à collecteur ouvert
.4 sorties analogiques
- 1 carte Veleman K6714-16 qui dispose de 16 relais commander en direct ou a collecteur ouvert

- plusieurs relais de puissance
- sonde de température (lm 35)
- sonde de ph
- sonde d'ec
et VB 2008
---------------------------------------------------------------

donc pour tout ce qui est de la partie électrique, je gère,
je bloque donc sur certaine partie de la programmation...

j'aimerai savoir si je pourrait avoir de l'aide sur une de ces parties

la partie extraction/température

voila ma sonde de température est câblé sur une entrée numérique (laquel me donne un voltage et donc une température grâce a une ligne de code...
mon extracteur est câblé sur un relais de puissance commande par la sortie a collecteur ouvert

ma demande de code serait que:

quand le soft lit 29 °C sur la sonde, il donne l'ordre a l'extracteur de se mettre en route...
puis quand la sonde lis 26, l'extracteur peut s’arrêter..

ci dessous la photo de mon soft!!

voulez vous que je mette le code de mon soft??

merci d'avance de me guider..

/URL

Uploaded with ImageShack.us/imga++

3 réponses

BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
3 mai 2012 à 09:02
Hello,
Il existe une section VB sur CodeS-SourceS. Je déplace ta demande dans la bonne section...


@+
Buno, Admin CS
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
3
lolokun Messages postés 1241 Date d'inscription mardi 10 octobre 2006 Statut Membre Dernière intervention 27 août 2013 7
3 mai 2012 à 09:03
Bonjour,

Alors déjà attention à la catégorie dans laquelle tu postes, il y a un forum dédié vb.net..

Ensuite, si tu as déjà du code pour nous montrer ou tu en es et ou tu bloques exactement, c'est toujours mieux de le mettre (en utilisant la coloration syntaxique, 3ème icone en partant de la droite) pour avoir une réponse claire et rapide..

Ta sonde et l'extracteur sont connectés comment au PC, comment récupères-tu l'info de la température?
Tu n'as pas une doc livrée avec qui explique comment les piloter?

L'expérience, c'est une connerie par jour, mais jamais la même..
3
filou220684 Messages postés 2 Date d'inscription mercredi 23 avril 2008 Statut Membre Dernière intervention 3 mai 2012
3 mai 2012 à 18:32
merci d'avoir déplacer Bruno, je m’était perdu...

ensuite lolo la sonde et l'extracteur sont connecter sur ma carte Veleman k8055 avec ces entrée et sortie qui elle est connecter via USB.

l'info de la température est récupérer en voltage qui lui est transformer grâce a ce code en température

Private Sub
Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_IOStatusReading.Tick, Timer3.Tick
Dim Data1 As Integer
Dim Data2 As Integer
Dim Data3 As Integer
Dim Data4 As Integer
Timer_IOStatusReading.Enabled = False
SetCurrentDevice(0)
ReadAllAnalog(Data1, Data2)
C0_IA1_VScrollBar.Value = 255 - Data1
C0_IA2_VScrollBar.Value = 255 - Data2
C0_IA1_Value.Text = CStr(Data1)
C0_IA1_Value.Text = ((101 * Data1 / 256) - 23)
TextBox3.Text = ((101 * Data1 / 256) - 23)
'VerticalBar1.Value = TextBox3.Text '
'C0_IA2_Value.Text = CStr(Data2) '

SetCurrentDevice(1)
ReadAllAnalog(Data3, Data4)
C1_IA1_VScrollBar.Value = 255 - Data3
C1_IA2_VScrollBar.Value = 255 - Data4
C1_IA1_Value.Text = CStr(Data3)
C1_IA2_Value.Text = CStr(Data4)
Timer_IOStatusReading.Enabled = True
End Sub

comment mettre du code en plus pour lui dire si tu monte la temp ou descend,mets en route la sortie pour mettre en marche l'extracteur...

je te mets le code entier de mon soft,

par contre je n'ai pas saisi comment utiliser la coloration syntaxique

merci



Public Class Form1
Const WM_CAP As Short = &H400S
Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Integer = WM_CAP + 30
Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
Const WS_CHILD As Integer = &H40000000
Const WS_VISIBLE As Integer = &H10000000
Const SWP_NOMOVE As Short = &H2S
Const SWP_NOSIZE As Short = 1
Const SWP_NOZORDER As Short = &H4S
Const HWND_BOTTOM As Short = 1
Dim iDevice As Integer
Dim hHwnd As Integer
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Object) As Integer
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean
Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Short, ByVal hWndParent As Integer, ByVal nID As Integer) As Integer
Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer As Integer) As Boolean
' Gestion Cartes IO
Dim n As Integer
Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Sub CloseDevice Lib "k8055d.dll" ()
Private Declare Function Version Lib "k8055d.dll" () As Integer
Private Declare Function SearchDevices Lib "k8055d.dll" () As Integer
Private Declare Function SetCurrentDevice Lib "k8055d.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Integer
Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByRef Data1 As Integer, ByRef Data2 As Integer)
Private Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer, ByVal Data As Integer)
Private Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Integer, ByVal Data2 As Integer)
Private Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub SetAllAnalog Lib "k8055d.dll" ()
Private Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
Private Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Integer)
Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub ClearAllDigital Lib "k8055d.dll" ()
Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub SetAllDigital Lib "k8055d.dll" ()
Private Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Boolean
Private Declare Function ReadAllDigital Lib "k8055d.dll" () As Integer
Private Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Integer) As Integer
Private Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Integer)
Private Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Integer, ByVal DebounceTime As Integer)


Private Sub OpenPreviewWindow() 'Gestion Webcam
Dim iHeight As Integer = picCapture1.Height
Dim iWidth As Integer = picCapture1.Width
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, picCapture1.Handle.ToInt32, 0)
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture1.Width, picCapture1.Height, SWP_NOMOVE Or SWP_NOZORDER)
Else
DestroyWindow(hHwnd)
End If
CheckBox1.Checked = True
End Sub

Private Sub ClosePreviewWindow() 'Gestion Webcam
SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0)
DestroyWindow(hHwnd)
CheckBox1.Checked = False
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick 'Gestion Webcam
Dim data As IDataObject
Dim bmap As Image
SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
data = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
picCapture1.Image = bmap
ClosePreviewWindow()
bmap.Save("C:\Users\philippe\Desktop\Nouveau dossier\Filles_" & Format(Now, "yyyyMMdd_HH-mm-ss") & ".jpg")
End If
OpenPreviewWindow()
End Sub





Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = FormatDateTime(Now, DateFormat.ShortTime)
Dim CardAddress As Integer
OpenDevice(CardAddress)
SetCurrentDevice(0)
ClearAllDigital()
SetCurrentDevice(1)
ClearAllDigital()

End Sub

Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
SetCurrentDevice(0)
ClearAllDigital()
ClearAllAnalog()
SetCurrentDevice(1)
ClearAllDigital()
ClearAllAnalog()
CloseDevice()
End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
OpenPreviewWindow()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_IOStatusReading.Tick, Timer3.Tick
Dim Data1 As Integer
Dim Data2 As Integer
Dim Data3 As Integer
Dim Data4 As Integer
Timer_IOStatusReading.Enabled = False
SetCurrentDevice(0)
ReadAllAnalog(Data1, Data2)
C0_IA1_VScrollBar.Value = 255 - Data1
C0_IA2_VScrollBar.Value = 255 - Data2
C0_IA1_Value.Text = CStr(Data1)
C0_IA1_Value.Text = ((101 * Data1 / 256) - 23)
TextBox3.Text = ((101 * Data1 / 256) - 23)
'VerticalBar1.Value = TextBox3.Text '
'C0_IA2_Value.Text = CStr(Data2) '

SetCurrentDevice(1)
ReadAllAnalog(Data3, Data4)
C1_IA1_VScrollBar.Value = 255 - Data3
C1_IA2_VScrollBar.Value = 255 - Data4
C1_IA1_Value.Text = CStr(Data3)
C1_IA2_Value.Text = CStr(Data4)
Timer_IOStatusReading.Enabled = True

End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_OAll_On.Click
SetCurrentDevice(0)
SetAllDigital()
C0_O1_Switch.BackColor = Color.GreenYellow
C0_O2_Switch.BackColor = Color.GreenYellow
C0_O3_Switch.BackColor = Color.GreenYellow
C0_O4_Switch.BackColor = Color.GreenYellow
C0_O5_Switch.BackColor = Color.GreenYellow
C0_O6_Switch.BackColor = Color.GreenYellow
C0_O7_Switch.BackColor = Color.GreenYellow
C0_O8_Switch.BackColor = Color.GreenYellow
Button1.BackColor = Color.GreenYellow
Button2.BackColor = Color.GreenYellow
Button3.BackColor = Color.GreenYellow
Button4.BackColor = Color.GreenYellow
Button6.BackColor = Color.GreenYellow
Button7.BackColor = Color.GreenYellow
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_OAll_Off.Click
SetCurrentDevice(0)
ClearAllDigital()
C0_O1_Switch.BackColor = Color.Red
C0_O2_Switch.BackColor = Color.Red
C0_O3_Switch.BackColor = Color.Red
C0_O4_Switch.BackColor = Color.Red
C0_O5_Switch.BackColor = Color.Red
C0_O6_Switch.BackColor = Color.Red
C0_O7_Switch.BackColor = Color.Red
C0_O8_Switch.BackColor = Color.Red
Button1.BackColor = Color.Red
Button2.BackColor = Color.Red
Button3.BackColor = Color.Red
Button4.BackColor = Color.Red
Button6.BackColor = Color.Red
Button7.BackColor = Color.Red
End Sub
Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_OAll_On.Click
SetCurrentDevice(1)
SetAllDigital()
C1_O1_Switch.BackColor = Color.GreenYellow
C1_O2_Switch.BackColor = Color.GreenYellow
C1_O3_Switch.BackColor = Color.GreenYellow
C1_O4_Switch.BackColor = Color.GreenYellow
C1_O5_Switch.BackColor = Color.GreenYellow
C1_O6_Switch.BackColor = Color.GreenYellow
C1_O7_Switch.BackColor = Color.GreenYellow
C1_O8_Switch.BackColor = Color.GreenYellow
Button5.BackColor = Color.GreenYellow
End Sub

Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_OAll_Off.Click
SetCurrentDevice(1)
ClearAllDigital()
C1_O1_Switch.BackColor = Color.Red
C1_O2_Switch.BackColor = Color.Red
C1_O3_Switch.BackColor = Color.Red
C1_O4_Switch.BackColor = Color.Red
C1_O5_Switch.BackColor = Color.Red
C1_O6_Switch.BackColor = Color.Red
C1_O7_Switch.BackColor = Color.Red
C1_O8_Switch.BackColor = Color.Red
Button5.BackColor = Color.Red
End Sub



Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_ControlNiveauEau.Tick
SetCurrentDevice(0)
C0_IAll_Hex.Text = ReadAllDigital()
If ReadDigitalChannel(1) = True Then

Else
VerticalBar5.Value = 10
SetCurrentDevice(0)
SetDigitalChannel(1)

End If

If ReadDigitalChannel(2) = True Then
VerticalBar5.Value = 60

Else
VerticalBar5.Value = 100
SetCurrentDevice(0)
ClearDigitalChannel(1)

End If



SetCurrentDevice(1)
C1_IAll_Hex.Text = ReadAllDigital()

End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O1_Switch.Click
If C0_O1_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(1)
C0_O1_Switch.BackColor = Color.GreenYellow
Button6.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(1)
C0_O1_Switch.BackColor = Color.Red
Button6.BackColor = Color.Red
End If
End Sub


Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O2_Switch.Click
If C0_O2_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(2)
C0_O2_Switch.BackColor = Color.GreenYellow
Button2.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(2)
C0_O2_Switch.BackColor = Color.Red
Button2.BackColor = Color.Red
End If
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O3_Switch.Click
If C0_O3_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(3)
C0_O3_Switch.BackColor = Color.GreenYellow
Button3.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(3)
C0_O3_Switch.BackColor = Color.Red
Button3.BackColor = Color.Red
End If
End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O4_Switch.Click
If C0_O4_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(4)
C0_O4_Switch.BackColor = Color.GreenYellow
Button4.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(4)
C0_O4_Switch.BackColor = Color.Red
Button4.BackColor = Color.Red
End If
End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O5_Switch.Click
If C0_O5_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(5)
C0_O5_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(5)
C0_O5_Switch.BackColor = Color.Red
End If
End Sub

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O6_Switch.Click
If C0_O6_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(6)
C0_O6_Switch.BackColor = Color.GreenYellow
Button1.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(6)
C0_O6_Switch.BackColor = Color.Red
Button1.BackColor = Color.Red
End If
End Sub
Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O7_Switch.Click
If C0_O7_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(7)
C0_O7_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(7)
C0_O7_Switch.BackColor = Color.Red
End If
End Sub
Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_O8_Switch.Click
If C0_O8_Switch.BackColor = Color.Red Then
SetCurrentDevice(0)
SetDigitalChannel(8)
C0_O8_Switch.BackColor = Color.GreenYellow
Button7.BackColor = Color.GreenYellow
Else
SetCurrentDevice(0)
ClearDigitalChannel(8)
C0_O8_Switch.BackColor = Color.Red
Button7.BackColor = Color.Red
End If
End Sub
Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O1_Switch.Click
If C1_O1_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(1)
C1_O1_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(1)
C1_O1_Switch.BackColor = Color.Red
End If
End Sub


Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O2_Switch.Click
If C1_O2_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(2)
C1_O2_Switch.BackColor = Color.GreenYellow
Button5.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(2)
C1_O2_Switch.BackColor = Color.Red
Button5.BackColor = Color.Red
End If
End Sub

Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O3_Switch.Click
If C1_O3_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(3)
C1_O3_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(3)
C1_O3_Switch.BackColor = Color.Red
End If
End Sub

Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O4_Switch.Click
If C1_O4_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(4)
C1_O4_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(4)
C1_O4_Switch.BackColor = Color.Red
End If
End Sub

Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O5_Switch.Click
If C1_O5_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(5)
C1_O5_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(5)
C1_O5_Switch.BackColor = Color.Red
End If
End Sub

Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O6_Switch.Click
If C1_O6_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(6)
C1_O6_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(6)
C1_O6_Switch.BackColor = Color.Red
End If
End Sub
Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O7_Switch.Click
If C1_O7_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(7)
C1_O7_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(7)
C1_O7_Switch.BackColor = Color.Red
End If
End Sub
Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_O8_Switch.Click
If C1_O8_Switch.BackColor = Color.Red Then
SetCurrentDevice(1)
SetDigitalChannel(8)
C1_O8_Switch.BackColor = Color.GreenYellow
Else
SetCurrentDevice(1)
ClearDigitalChannel(8)
C1_O8_Switch.BackColor = Color.Red
End If
End Sub

Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C0_OA1_VScrollBar.Scroll
SetCurrentDevice(0)
C0_OA1_Value.Text = CStr(255 - C0_OA1_VScrollBar.Value)
OutputAnalogChannel(1, 255 - C0_OA1_VScrollBar.Value)
End Sub

Private Sub VScrollBar2_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C0_OA2_VScrollBar.Scroll

SetCurrentDevice(0)
C0_OA2_Value.Text = CStr(255 - C0_OA2_VScrollBar.Value)
OutputAnalogChannel(2, 255 - C0_OA2_VScrollBar.Value)
End Sub



Private Sub VScrollBar5_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C1_OA1_VScrollBar.Scroll
SetCurrentDevice(1)
C1_OA1_Value.Text = CStr(255 - C1_OA1_VScrollBar.Value)
OutputAnalogChannel(1, 255 - C1_OA1_VScrollBar.Value)
End Sub

Private Sub VScrollBar6_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C1_OA2_VScrollBar.Scroll
SetCurrentDevice(1)
C1_OA2_Value.Text = CStr(255 - C1_OA2_VScrollBar.Value)
OutputAnalogChannel(2, 255 - C1_OA2_VScrollBar.Value)
End Sub


Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_OAAll_Max.Click
SetCurrentDevice(0)
SetAllAnalog()
C0_OA1_VScrollBar.Value = 0
C0_OA2_VScrollBar.Value = 0
C0_OA1_Value.Text = "255"
C0_OA2_Value.Text = "255"
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C0_OAAll_Min.Click
SetCurrentDevice(0)
ClearAllAnalog()
C0_OA1_VScrollBar.Value = 255
C0_OA2_VScrollBar.Value = 255
C0_OA1_Value.Text = "0"
C0_OA2_Value.Text = "0"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_OAAll_Max.Click
SetCurrentDevice(1)
SetAllAnalog()
C1_OA1_VScrollBar.Value = 0
C1_OA2_VScrollBar.Value = 0
C1_OA1_Value.Text = "255"
C1_OA2_Value.Text = "255"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1_OAAll_Min.Click
SetCurrentDevice(1)
ClearAllAnalog()
C1_OA1_VScrollBar.Value = 255
C1_OA2_VScrollBar.Value = 255
C1_OA1_Value.Text = "0"
C1_OA2_Value.Text = "0"
End Sub

Private Sub C1_IA1_VScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C1_IA1_VScrollBar.Scroll

End Sub
Private Sub C0_IA2_VScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C0_IA2_VScrollBar.Scroll

End Sub
Private Sub C0_IA1_VScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C0_IA1_VScrollBar.Scroll

End Sub
Private Sub C1_IA2_VScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles C1_IA2_VScrollBar.Scroll

End Sub

Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = FormatDateTime(Now, DateFormat.ShortTime)
If Label1.Text = TextBox1.Text Then
If CheckBox1.Checked = False Then OpenPreviewWindow()
PictureBox1.Visible = True
Timer2.Enabled = True
SetCurrentDevice(0)
SetDigitalChannel(3)
SetDigitalChannel(2)
C0_O2_Switch.BackColor = Color.GreenYellow
Button2.BackColor = Color.GreenYellow
End If
If Label1.Text = TextBox2.Text Then
If CheckBox1.Checked = True Then ClosePreviewWindow()
PictureBox1.Visible = False
Timer2.Enabled = False
SetCurrentDevice(0)
ClearDigitalChannel(3)
ClearDigitalChannel(2)
C0_O2_Switch.BackColor = Color.Red
Button2.BackColor = Color.Red
End If
End Sub
Private Sub Timer4_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Label1.Text = FormatDateTime(Now, DateFormat.ShortTime)
If Label1.Text = TextBox8.Text Then
SetCurrentDevice(0)
SetDigitalChannel(6)
C0_O6_Switch.BackColor = Color.GreenYellow
Button1.BackColor = Color.GreenYellow
End If
If Label1.Text = TextBox7.Text Then
SetCurrentDevice(0)
ClearDigitalChannel(6)
C0_O6_Switch.BackColor = Color.Red
Button1.BackColor = Color.Red
End If
End Sub

End Class
0
Rejoignez-nous