Netduino home hardware projects downloads community

Jump to content


Photo

If referencing Wi-Fi assemblies - PWM doesn't work anymore

PWM Wi-Fi Netduino 3 Wireless

  • Please log in to reply
1 reply to this topic

#1 shiv.kumar

shiv.kumar

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 25 January 2016 - 04:43 PM

I have a simple project that uses PWM to dim and brighten the on-board LED.

 public class Program
    {
        public static void Main()
        {
            PWM led1 = new PWM(PWMChannels.PWM_ONBOARD_LED, 100d, 0.001d, false);
            led1.Start();
            while (true)
            {
                for (var startValue = 4.712d; startValue < 10.995; startValue = startValue + 0.005)
                {
                    double endValue = System.Math.Sin(startValue) * .5 + .5;                    
                    led1.DutyCycle = endValue;
                    Thread.Sleep(10);
                }
            }
        }
    }

This works as expected only if I don't reference the Microsoft.SPOT.Wireless.IEEE_802_15_4 assembly.

 

If I do reference this assembly then the PWM doesn't work. Just to be clear, I don't make any code changes. I simply add the assembly reference.

 

Has anyone else experienced this? Or could someone try this on their end to see if they get the same behavior ?

 



#2 shiv.kumar

shiv.kumar

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 25 January 2016 - 07:45 PM

Sorry guys, false alarm.

 

I have a static class with a static PWM member in my project. It is not used (referenced) anywhere in the project. However one of the PWM pins was conflicting with another class that was in use). It seems that in NETMF, static members are initialized even though the type itself is never referenced.

 

It took me a while to nail it down but eventually, I commented the class out and that cured the problem and so that's how it figured this issue out.

 

Anyway, I do have my Netduino 3 Wi-Fi working with PWM working as well. Whew!







Also tagged with one or more of these keywords: PWM, Wi-Fi, Netduino 3, Wireless

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.