• Welcome to LusoRobótica - Robótica em Português.
 

VB.NET Arduino

Started by magtaem, 24 de June de 2014, 20:11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

magtaem

Boas pessoa,

Tou aqui com uma dúvida referente a uma comparação de dados em VB.net do arduino.

If (SerialPort2.ReadLine >= "0" < "500") Then


                distancia = SerialPort2.ReadLine
            End If


            If (SerialPort2.ReadLine >= "500" < "2000") Then


                aguatemp = SerialPort2.ReadLine
            End If

            If (SerialPort2.ReadLine >= "3000" < "4000") Then


                gas = SerialPort2.ReadLine
            End If

            If (SerialPort2.ReadLine >= "4000" < "5000") Then


            humidade = SerialPort2.ReadLine
            End If

            If (SerialPort2.ReadLine >= "5000" < "7000") Then


                temperaturesen = SerialPort2.ReadLine
            End If

            If (SerialPort2.ReadLine >= "8000" < "9000") Then


                fluxoagua = SerialPort2.ReadLine
            End If

            If (SerialPort2.ReadLine = "movimento") Then


                movimento = SerialPort2.ReadLine

            End If


Coloquei uma msgbox antes para dar o resultado e ele imprime o problema é aqui no código, acho que a comparação est´mal , mas ja tentei de variadas maneiras. Em relação ás comparações de valor muito altas eu sei , mas é para depois saber de que sensor estou a tratar.

Desde já muito obrigado,

Cumprimentos
"O mundo pertence a quem se atreve"

poliveira1978


If (SerialPort2.ReadLine >= "0" < "500") Then

não devia ser

If ((SerialPort2.ReadLine >= "0") and (SerialPort2.ReadLine < "500")) Then

o meu vb está um bocado enferrujado, mas a sintaxe deve ser algo daquele género.

magtaem

Mano obrigada o estava a atrufiar com esta sintaxe agora .
Cumprimentos
"O mundo pertence a quem se atreve"