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

Trouble with the pins on plus2


  • Please log in to reply
9 replies to this topic

#1 sdiestler

sdiestler

    New Member

  • Members
  • Pip
  • 2 posts

Posted 26 January 2013 - 05:57 PM

OK, I am admittedly a noob here, but I have done the blinky light stuff and I have moved on to ever so slightly more complex circuits. I can't get the digital outs to work on my new ND+2, I have verified the circuit on my netduino go with the shieldbase so I am a bit confused here. and I am not sure what else to do. code is simply like this

 

so light up the onboard led and output pin 7 for one second then just loop forever doing nothing. Not terribly complex. the Led lights up, but the output never works. (all it's doing is lighting another LED triggered via a transistor)

 

 

  public static void Main()   {   OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);   OutputPort trigger = new OutputPort(Cpu.Pin.GPIO_Pin7, false);     led.Write(true);   trigger.Write(true);   Thread.Sleep(1000);   led.Write(false);   trigger.Write(false);

  while (true)   {   Thread.Sleep(1000);   }   }



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 January 2013 - 06:42 PM

Hi sdiestler, You want Pins.GPIO_PIN_D7, not Cpu.Pin.GPIO_Pin7. I know that they look similar--but the first one is the D7 header on your Netduino Plus 2. And the second one is physical pin "7" (A7) on the STM32F4 "Cpu" itself. Which is a data line going to the onboard networking chip. Welcome to the Netduino community, Chris

#3 sdiestler

sdiestler

    New Member

  • Members
  • Pip
  • 2 posts

Posted 26 January 2013 - 09:36 PM

Doh! Thanks, figured it was something like that.

#4 Dan Olson

Dan Olson

    New Member

  • Members
  • Pip
  • 3 posts

Posted 27 January 2013 - 07:03 PM

I'm new to NetDuino and I've got a similar problem.  I've got a Netduino Plus 2 and I'm trying to follow the code on p.38 of "Getting Started with Netduino."  The code: AnalogInput pot = new AnalogInput(Pins.GPIO_PIN_A0); gives me 3 error messages when I try to compile it.

 

 

Warning 1 '2008' is not a valid warning number analoginput1

 

 

Error 2 The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments C:UsersDandocumentsvisual studio 2010Projectsanaloginput1analoginput1Program.cs 18 31 analoginput1
 
Error 3 Argument 1: cannot convert from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel' C:UsersDandocumentsvisual studio 2010Projectsanaloginput1analoginput1Program.cs 18 47 analoginput1
 
Any ideas what's going on?
 
Thanks,
Dan


#5 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 27 January 2013 - 07:14 PM

yes, the last 2 messages say it.

 

i does not like Pins.yourpin -

it wants AnalogChannels.yourpin



#6 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 January 2013 - 09:26 PM

Hi Dan,

 

I was interested in your problem as I am in the process of switching from v4.1 to v4.2 on an older Netduino Plus Rev B (version 1).

 

I just tried this out with Visual Studio set to build for v4.2:

Note that I have only compiled this code - I have not run it.

using Microsoft.SPOT;//using Microsoft.SPOT.Hardware;                // Causes ambiguity over AnalogInput class if enabledusing SecretLabs.NETMF.Hardware;                // Needed for AnalogInput classusing SecretLabs.NETMF.Hardware.NetduinoPlus;   // Needed for Pins enumerationnamespace Sandbox{    public class Program    {        public static void Main()        {            // This code only compiles without "using Microsoft.SPOT.Hardware"            AnalogInput pot1 = new AnalogInput(Pins.GPIO_PIN_A0);            int value1 = pot1.Read();            Debug.Print("Analogue value = " + value1);            // This code compiles with or without "using Microsoft.SPOT.Hardware"            SecretLabs.NETMF.Hardware.AnalogInput pot2 = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);            int value2 = pot2.Read();            Debug.Print("Analogue value = " + value2);        }    }}

I think the issue is that there is an AnalogInput class in both the Microsoft and the secret labs software, so if you have both usings the compiler does not know which one you are trying to use.

 

Hope this helps - Paul



#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 January 2013 - 10:17 PM

To add to what Paul said... To use the legacy AnalogInput and PWM classes, you'll want to specify their full names:
SecretLabs.NETMF.Hardware.AnalogInput analogInput = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);SecretLabs.NETMF.Hardware.PWM pwm = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D7);
Chris

#8 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 28 January 2013 - 07:19 AM

Chris,

"legacy" means don't use any more?

If you want to uae the new ones, I guess you have to drop the using secretlabs...pwm and analog lines?

Paul



#9 bizmut

bizmut

    New Member

  • Members
  • Pip
  • 2 posts

Posted 20 July 2014 - 12:13 AM

Hi , this is my first app,i have a problem like this may be i am not sure,

 

I try that code on Netduino Plus 2 Fw 4.3.1 , on board LED blinks but when i measure voltage on digital0 and GND pair it show voltmeter 0.00-0.01 v. So what is wrong ? it should be 3.3v right? Did i broke digital output pins ?

 

 
        public static void Main()
        {
            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
            OutputPort v = new OutputPort(Pins.GPIO_PIN_D0, false);
 
            while (true)
            {
                led.Write(true);
                v.Write(true);
 
                Thread.Sleep(500);
                
                led.Write(false);
                v.Write(false);
                
                Thread.Sleep(500);
            }
        }


#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 August 2014 - 07:05 PM

Hi bizmut,

At first glance this should be working for you. Have you tried other digital pins? Have you tried putting an LED into one of the digital pins and GND (to rule out the voltmeter as a potential issue)?

You could also wire two digital pins together and read the value on one of them (to make sure you're sending proper signal voltages).

We test every digital pin before these boards leave the factory: it's possible that one of the pins is damaged, but let's drill down a bit more first.

Chris

P.S. Photos of your voltmeter, board and voltage reading--where we can see everything--may help us help you diagnose the issue here too.




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.