Remote Arduino and Firmata

Hi Guys

I'm trying to receive analog data from arduino...
I'm using Firmata and Windows Apps with Remote Arduino.

For some reason I can't read analog values: I can read and write digital pins but I cant read the analog ones (not tried yet to write).

The funny thing is that using "Windows Remote Arduino Experience" app I can read those analog values correctly, so my problem is not the wiring, the sendor neither the firmata sketch. The problem must lie on my vb code.

So here's a piece of VB code how I'm trying to read values:

Dim _Connection As New UsbSerial("VID_1A86", "PID_7523" )
Dim _RemoteDevice As New RemoteDevice(_Connection)
_Connection.begin(57600, SerialConfig.SERIAL_8N1)

'reading digital values
Dim vDPinState = _RemoteDevice.digitalRead(0)

'reading analog values
_RemoteDevice.pinMode("0", PinMode.INPUT)
Dim vAPinValue = _RemoteDevice.analogRead("0")

The value vAPinValue is always 65535 and if I try to use get the pin mode (after assign to input)

Dim v = _RemoteDevice.getPinMode("0")

I get that the pin mode is IGNORED...

So there's something wrong with my code.

Can anyone help me here?

Thanks

Dim vAPinValue = _RemoteDevice.analogRead("0")

Why are you passing a string to a function that expects an int? You didn't pass a string to the digitalRead() function.

Dim v = _RemoteDevice.getPinMode("0")

Same question.

Hi

Because the function is

Public Function analogRead(analog_pin_ As String) As UShort

and pinmode has 2 entry

Public Sub pinMode(pin_ As Byte, mode_ As PinMode)
Public Sub pinMode(analog_pin_ As String, mode_ As PinMode)

even if it was integer or byte .NET parses strings to integer or byte, not the case.
also tried that, with byte, string, and everything else I could remember...

Just calling back this issue because I'm still stuck with this... :frowning:

Hi, I have in my application this source code:

private void button2_Click(object sender, RoutedEventArgs e)
{
int value;
arduino.pinMode("A0", PinMode.ANALOG);
string sensorPin = "A0";
value = arduino.analogRead(sensorPin);
tbData.Text = value.ToString();
}

First I had the same problem, value returned 65535, but when i added
arduino.pinMode("A0", PinMode.ANALOG) to source code, it works OK.