Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Plus 2 - AnalogInput & SetRange errors


  • Please log in to reply
7 replies to this topic

#1 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 06 March 2013 - 03:38 AM

Hi,

 

I am using Netduino Plus 2 and I followed the steps from 'Getting Started with Netduino' pdf on Chapter 5. I encountered few problems on the coding. There are 4 errors. Please help me!

 

 

 

Error 1 The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments
 
Error 2 Argument 1: cannot convert from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel'
 

 

Error 3 'Microsoft.SPOT.Hardware.AnalogInput' does not contain a definition for 'SetRange' and no extension method 'SetRange' accepting a first argument of type 'Microsoft.SPOT.Hardware.AnalogInput' could be found (are you missing a using directive or an assembly reference?)
 
Error 4 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)

 

Looking forward to your speedy response. Thank you!



#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 March 2013 - 08:03 AM

Hi and welcome to the Netduino forums!

 

The book describes the Netduino API, I think your problem would be fixed if you'd remove the reference to Microsoft.SPOT.Hardware.AnalogInput.dll and add a reference to SecretLabs.NETMF..Hardware.AnalogInput.dll


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 06 March 2013 - 10:08 AM

Hi and welcome to the Netduino forums!

 

The book describes the Netduino API, I think your problem would be fixed if you'd remove the reference to Microsoft.SPOT.Hardware.AnalogInput.dll and add a reference to SecretLabs.NETMF..Hardware.AnalogInput.dll

 

After following your instructions, there are more errors.. Anyway i am new to this Netduino Plus 2.. Could you please explain to me in detail? Thank you.

 

 

Error 1 'AnalogInput' is an ambiguous reference between 'Microsoft.SPOT.Hardware.AnalogInput' and 'SecretLabs.NETMF.Hardware.AnalogInput'
 
Error 2 'AnalogInput' is an ambiguous reference between 'Microsoft.SPOT.Hardware.AnalogInput' and 'SecretLabs.NETMF.Hardware.AnalogInput'
Error 3 The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments
 
Error 4 Argument 1: cannot convert from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel'
 
Error 5 'Microsoft.SPOT.Hardware.AnalogInput' does not contain a definition for 'SetRange' and no extension method 'SetRange' accepting a first argument of type 'Microsoft.SPOT.Hardware.AnalogInput' could be found (are you missing a using directive or an assembly reference?)
 
Error 6 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)
 


#4 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 March 2013 - 10:10 AM

Error 1 to 5 are probably because you only added the secretlabs reference but didn't remove the microsoft.spot.hardware.analoginput reference.

Now it has both options, which the IDE can't work with.

 

Error 6: without code it's difficult to help you out there!


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#5 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 07 March 2013 - 12:44 AM

Refer to the attached.

 

Attached File  error on measuring volt.JPG   43.8KB   48 downloads

 

 

 

 



#6 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 07 March 2013 - 07:30 AM

Problem solved ! Thank you ! :)



#7 zenmanenergy

zenmanenergy

    New Member

  • Members
  • Pip
  • 4 posts

Posted 11 March 2013 - 03:26 AM

How was the problem solved? I'm facing the exact same problem now.

 

number 6 seems to be just a matter of changing int potValue=0; to double potValue=0;



#8 zee

zee

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 11 March 2013 - 05:55 AM

How was the problem solved? I'm facing the exact same problem now.

 

number 6 seems to be just a matter of changing int potValue=0; to double potValue=0;

 

 

I include the SecretLabs.NETMF.Hardware.AnalogInput command infront & add reference 'SecretLabs.NETMF.Hardware.AnalogInput..

 

eg:

SecretLabs.NETMF.Hardware.AnalogInput pot = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.