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.

Fabian Nunez

Member Since 10 May 2011
Offline Last Active Apr 01 2013 09:54 PM
-----

Posts I've Made

In Topic: GO! Module wishlist

28 April 2012 - 10:15 AM

Optical mouse sensor, with a modified lens so it can be used as a (very) low resolution camera for basic machine vision. The most common sensors have SPI interfaces, so they're easy to use. See eg here and here (pdf doc).

In Topic: SparkFun Inventor's Kit / CIRC-05 | 8 More LEDs - 74HC595 Shift Register

26 April 2012 - 09:24 PM

Static objects are always tricky, especially if you don't own all the modules as is the case here. What is probably happening is that your static initializer is being called before those of the other classes you're calling. I think the best fix is to use gbreder's solution.

In Topic: SparkFun Inventor's Kit / CIRC-05 | 8 More LEDs - 74HC595 Shift Register

26 April 2012 - 04:52 AM

NP. Always glad to share my obscure .net knowledge :)

In Topic: SparkFun Inventor's Kit / CIRC-05 | 8 More LEDs - 74HC595 Shift Register

26 April 2012 - 04:35 AM

The reason you're having problems is that .net doesn't guarantee the initialization order of static fields in a class. If you need them initialized in a particular way (eg they depend on each other), you have to write a static constructor for the class. This is just a method that has the same name as the class, just like a regular constructor, but has the 'static' qualifier in front of it. This static constructor will be called sometime between the module being loaded and the first time the class is used.

public class program
{
        static ShieldBase shieldBase;
        static OutputPort data;
        static OutputPort clock;
        static OutputPort latch;
        
        static program()
        {
            shieldBase = new ShieldBase(GoSockets.Socket5);
            data = new OutputPort(shieldBase.Pins.GPIO_PIN_D2, false);  //Set pin 2 as an output and our data line
            clock = new OutputPort(shieldBase.Pins.GPIO_PIN_D3, false); //Set pin 3 as an output and our clock line
            latch = new OutputPort(shieldBase.Pins.GPIO_PIN_D4, false); //Set pin 4 as an output and our latch line
        }

        public static void Main()   
        {
           // everything is already initialized when you enter this function
        }
}

In Topic: What date will the downloads be available?

10 April 2012 - 07:22 AM

@Antti Dude, relax. Schedules slip all the time, and it's only been a couple of days. It's aggressive attitudes like yours that push companies away from open source. These guys could have made the Go bus proprietary, patented the bus protocol and implemented everything as a closed source set of libraries running on top of .net micro - it's allowed by the license. They chose to open source everything. Cut them some slack.

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.