Hey guys,
I'm having some issues with my program. I connected my scope to the output of the PWM, but I'm only getting a solid 3.3v. Anyone have a Netduino and a scope handy? I need a reality check here...
Thanks!
P.S. I disabled the adjustments to make life easier?
using System;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;// Uses .NETMF 4.1namespace PWM_Tester{ public class Program { public static void Main() { AnalogInput Frequency_Pot = new AnalogInput(Pins.GPIO_PIN_A0); AnalogInput Duty_Pot = new AnalogInput(Pins.GPIO_PIN_A1); PWM Test_PWM = new PWM(Pins.GPIO_PIN_D5); while (true) { double Freq_Hz_Bits = Frequency_Pot.Read(); double Duty_Cycle_Bits = Duty_Pot.Read(); double Freq_Hz_Scale = Freq_Hz_Bits / 1023; // To scale from 0-1 double Duty_Cycle_Scale = Duty_Cycle_Bits / 1023; // To scale from 0-1 int Duty_Cycle = 50; //(int)(Duty_Cycle_Scale * 100); // To scale from 0-100% uint PWM_Min = 10; // In Hz uint PWM_Max = 400; //In Hz int Freq_Hz = 100; //(int)(PWM_Min + (Freq_Hz_Scale * (PWM_Max - PWM_Min))); uint period = (uint)((1 / Freq_Hz) * 1000 * 1000); // Period in usec (*microseconds*) uint duration = (uint)(Duty_Cycle_Scale * period); // Duration in usec Test_PWM.SetPulse(period, duration); Debug.Print("Duty Cycle = " + Duty_Cycle + "%"); Debug.Print("Frequency = " + Freq_Hz + "Hz"); Thread.Sleep(100); } } }}