LusoRobótica - Robótica em Português

Sistemas específicos => Arduino / AVR => Tópico iniciado por: magtaem em 24 de Junho de 2014, 20:11

Título: VB.NET Arduino
Enviado por: magtaem em 24 de Junho de 2014, 20:11
Boas pessoa,

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

Código: [Seleccione]
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
Título: Re: VB.NET Arduino
Enviado por: poliveira1978 em 24 de Junho de 2014, 21:50
Código: [Seleccione]
If (SerialPort2.ReadLine >= "0" < "500") Then
não devia ser
Código: [Seleccione]
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.
Título: Re: VB.NET Arduino
Enviado por: magtaem em 24 de Junho de 2014, 21:57
Mano obrigada o estava a atrufiar com esta sintaxe agora .
Cumprimentos