public static void TestFakeSensor() { PWM pwm = new PWM(PWM.Pin.PWM1); for (byte d = 0; d < 100; d++) { pwm.Set(1200, d); for (int i = 0; i < 5; i++) { Debug.Print("Out: " + d + ",\tIn: " + getReading()); } Thread.Sleep(100); } }
// static Dial[] dials = new Dial[3]; // static I2CDevice.Configuration i2con; // static I2CDevice i2c; public static void Heartbeat() { sbyte dirr = 1; byte duty = 40; PWM pwm = new PWM((PWM.Pin)FEZ_Pin.PWM.LED); while (true) { pwm.Set(10000, duty); duty = (byte)(duty + dirr); if (duty > 98 || duty < 2) { dirr *= -1; } Thread.Sleep(10); } }
private static void Ramp(int start, int end, sbyte dir, int dur, PWM color) { sbyte diff = 0; int durStep = 0; if (dur > 0) { diff = (sbyte)System.Math.Abs(start - end); if (diff > 0) { durStep = (int)((dur * TimeSpan.TicksPerMinute) / (diff * TimeSpan.TicksPerMillisecond)); } } for (byte x = (byte)start; start != end; start = (byte)(start + dir)) { x = (byte)(x + dir); Thread.Sleep(durStep); color.Set(5000, x); } }
int valoreVentola; //Valore proporzionale della ventola. #endregion Fields #region Constructors /// <summary> /// Costruttore della ventola. /// </summary> /// <param name="pin">pin ventolA</param> public Ventola(FEZ_Pin.PWM pin) { //Output PWM pwmVentola = new PWM(((PWM.Pin)pin)); //Creazione porta per la ventola. pwmVentola.Set(false); //Pwm ventola a false. }