Hi Franki,
believe me, I'm trying my best to help you
. I'll try to explain in detail how it should work.
There are two AnalogIn classes, one of Microsoft (Microsoft.SPOT.Hardware.AnalogInput) and one of SecretLabs (SecretLabs.NETMF.Hardware.AnalogInput). In the last code you gave, you import both of these namespaces, you now can not use AnalogIn without specifying it's full name. Otherwise the compiler does not know which class to use (ambiguous).
I am using the one supplied by Microsoft, for this you only need references to the following:
Microsoft.SPOT.Hardware (4.2.0.0)
Microsoft.SPOT.Native (4.2.0.0)
mscrorlib (4.2.0.0)
SecretLabs.NETMF.Hardware.NetduinoPlus ((4.2.0.1)
I made a small program with nothing more than the code as shown below. Just to make sure that there are no conflicts in imports, I used the full names of the classes:
AanalogIn > Microsoft.SPOT.Hardware.AnalogInput
ANALOG_PIN_A0 > SecretLabs.NETMF.Hardware.NetduinoPlus.AnalogChannels.ANALOG_PIN_A0
The AnalogIn class contains the functionality of sampling an analog input. But Microsoft does not know anything about the Netduino Plus. Therefor SecretLabs made a nice little class to map the Netduino's PINs to the ones expected by the AnalogIn class.
The code:
Option Explicit On
Option Strict On
Imports Microsoft.SPOT
Namespace MFConsoleApplication1
Public Module Module1
Sub Main()
Dim potMeter As New Microsoft.SPOT.Hardware.AnalogInput(SecretLabs.NETMF.Hardware.NetduinoPlus.AnalogChannels.ANALOG_PIN_A0)
For i As Integer = 1 To 50
Debug.Print("Value: " & potMeter.Read().ToString())
Next
End Sub
End Module
End Namespace
A few lines of the debug output:
Value: 0.0019550342130987292
Value: 0.015640273704789834
Value: 0.016617790811339198
Value: 0.00097751710654936461
Value: 0.0019550342130987292
Value: 0.01466275659824047
Value: 0.016617790811339198
O one last thing I can think of, do you have firmware 4.2 on your Netduino? The one's I just bought arrived with firmware 4.1 on it.
Hope this helps!
Regards,
Kem
OK, scratch that about the firmware, you've said that already in your first post
Edited by Kem, 20 September 2012 - 07:13 PM.