Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i cant display image from sensors values

Status
Not open for further replies.

ElaineLMQ

Newbie level 1
Joined
Oct 31, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
hi, i am having a project that is relating to the development of smart lab, which i have a device that acts as a sensor to sense the environment.
basically i have a ZigBee sender to send information of the lab condition to coordinator and then to GUI Visual Basic.
now, i'll need to further enhance the GUI image display.
I added 2 pictures into picturebox, so that the picture of "LAB IS ON" will be display when the sensor detect the luminosity value is > 1V.
however a picture of "LAB IS OFF" displays when sensors detects luminosity value is <1 V.
but it seems like my displaying of pic sequence is incorrect.

and i would like to ask is, how the program will gets notified by the "Luminosity Value" so that it can know which picture to show.
Thank you


Code Visual Basic - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Private Sub ReceivedText(ByVal [text] As String)
 
        If Me.TextBox6.InvokeRequired Then
            Dim x As New SetTextCallback(AddressOf ReceivedText)
            Me.Invoke(x, New Object() {(text)})
        End If
 
        data &= [text]
 
        If InStr(data, "Data not received") Then
            data = ""
            TextBox6.Text = "Data lost" + vbNewLine
        End If
 
        If InStr(data, "Lab Location: S.429") Then
            If InStr(data, "Temperatur Value") Then
                If InStr(data, "Humidity Value") Then
                    If InStr(data, "Luminosity Value") Then
                        txt1 = 1
 
                        txt2 = 0
                        txt3 = 0
                        txt4 = 0
                        txt5 = 0
 
                        data2 = data
                    End If
                End If
            End If
        End If
 
        If InStr(data, "Lab Location: S.434") Then
            If InStr(data, "Temperature Value") Then
                If InStr(data, "Humidity Value") Then
                    If InStr(data, "Luminosity Value") Then
                        txt2 = 1
 
                        txt1 = 0
                        txt3 = 0
                        txt4 = 0
                        txt5 = 0
 
                        data2 = data
                    End If
                End If
            End If
        End If
 
        If InStr(data, "Lab Location: S.439") Then
            If InStr(data, "Temperature Value") Then
                If InStr(data, "Humidity Value") Then
                    If InStr(data, "Luminosity Value") Then
                        txt3 = 1
 
                        txt1 = 0
                        txt2 = 0
                        txt4 = 0
                        txt5 = 0
 
                        data2 = data
                    End If
                End If
            End If
        End If
 
        If InStr(data, "Lab Location: S.449") Then
            If InStr(data, "Temperature Value") Then
                If InStr(data, "Humidity Value") Then
                    If InStr(data, "Luminosity Value") Then
                        txt4 = 1
 
                        txt1 = 0
                        txt2 = 0
                        txt3 = 0
                        txt5 = 0
 
                        data2 = data
                    End If
                End If
            End If
        End If
 
        If InStr(data, "Lab Location: S.368") Then
            If InStr(data, "Temperature Value") Then
                If InStr(data, "Humidity Value") Then
                    If InStr(data, "Luminosity Value") Then
                        txt5 = 1
 
                        txt1 = 0
                        txt2 = 0
                        txt3 = 0
                        txt4 = 0
 
                        data2 = data
                    End If
                End If
            End If
        End If
 
 
        If InStr(LuminosityValue, "Luminosity Value") > 1 Then
            PictureBox2.Image = System.Drawing.Bitmap.FromFile("C:\Users\wdl1\Desktop\Project Example\Development of SMART Lab\SMART Lab\GUI\GUI\My Project\S.439_ON.JPG")
 
        ElseIf InStr(LuminosityValue, "Luminosity Value") < 1 Then
            PictureBox2.Image = System.Drawing.Bitmap.FromFile("C:\Users\wdl1\Desktop\Project Example\Development of SMART Lab\SMART Lab\GUI\GUI\My Project\S.439_OFF.JPG")
        End If

 
Last edited by a moderator:

If InStr(LuminosityValue, "Luminosity Value") > 1 Then

Does this mean that when valid data is coming in, the variable called 'LuminosityValue' will contain the text "Luminosity Value"? Will it start at the first character?

If so then you need to change the operator to '>0' (or '>=1').
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top