コード例 #1
0
        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);

            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: nocoolnicksleft/yukidreh
 // 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);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Gorgok/Fishy-Brains
 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);
     }
 }
コード例 #4
0
ファイル: Ventola.cs プロジェクト: gamondue/GrowBox-5F-16
        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.
        }