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

Safely remove Netduino


  • Please log in to reply
4 replies to this topic

#1 BowWowTama

BowWowTama

    New Member

  • Members
  • Pip
  • 8 posts

Posted 08 June 2012 - 02:25 AM

Hi there. Sorry for my poor English first.

I have been a .NET developer about 2 years and I got a netduino just a few minutes ago. Yeah!

I connected it to the usb port and installed .NET MF and SDK sets. but failed to create a project with Netduino. I searched the forum a few minutes and found that you have to put templates in the documents folder located in local drive. I have my documents folder in "E" drive. It was really embarrassing...

OK, here's a question.

1. Is there anything that I have to pay attention or be cautious when I attempt to remove Netduino devices from computer?
2. you know, there's a guide for a newbie and it has the first project tutorial about turning on and off the LED on the board.
I succeeded and while the LED was blinking, I tried to do following code.

public static void Main()
		{
			OutputPort outport = new OutputPort(Pins.ONBOARD_LED, false);

			outport.Write(false);
			Thread.Sleep(250);
			outport.Dispose();
		}

Instead of turning off, it remained turned on(not blinking).
But just "outport.Write(false);" removing other lines did the job.

3. From the above code, do I have to use "Dispose" method actually? I think that because netduino has a embeded framework on the chip and there must be a garbage collector. So from the view of managing memory, I guess it is necessary to dispose the method. but it can't do...
Let me sing you forever

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 June 2012 - 03:26 AM

Hi BowWowTama, You only need to Dispose of objects when you want to use their resources elsewhere. For instance if you are using pin A4 as an AnalogInput and want to switch to using it as an OutputPort, you'll need to Dispose of it first. .NET Micro Framework does have a garbage collector. No worries there. As far as unplugging your Netduino from your computer goes, it's safe to remove it at any time. Welcome to the Netduino community, Chris

#3 BowWowTama

BowWowTama

    New Member

  • Members
  • Pip
  • 8 posts

Posted 08 June 2012 - 01:44 PM

Thanks for the reply. and for the LED blinking, it seems that "Write" method gets boolean value which doesn't refer absolute states of the LED. I guess I have to turn it on and off just by reversing its state. I thought that if I give the device "Write(false)", I could turn off the LED... anyway, I solved it. See you and regards.
Let me sing you forever

#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 08 June 2012 - 02:05 PM

it seems that "Write" method gets boolean value which doesn't refer absolute states of the LED

The Write() method call changes the output state to the logic level represented by the parameter. But as you've already observed, this does not necessarily equal to the state of the connected device. The LED can be connected in two ways: if it is between the pin and ground (the pin "sources" the current), the control logic is 'normal' (i.e. true = on, false = off), if it is between positive voltage and the pin (the pin "sinks" the current), the control logic is inverted (true = off, false = on).

You may find the latter to be used more often, mostly due to historical reasons (CMOS and TTL circuits can sink more current than source).

#5 BowWowTama

BowWowTama

    New Member

  • Members
  • Pip
  • 8 posts

Posted 12 June 2012 - 01:36 PM

Thanks for the reply. have a nice day~ :)
Let me sing you forever




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.