예제 #1
0
        private static void DoPWM()
        {
            var driverHandler = new ServoDriver();

            driverHandler.Configure();
            driverHandler.Reset();
            Console.WriteLine($"Obtained hanlder: {driverHandler}");
            Console.ReadKey();

            string readedValue;

            while (true)
            {
                Console.WriteLine("Give me value:");
                readedValue = Console.ReadLine();

                if (string.IsNullOrEmpty(readedValue))
                {
                    break;
                }

                driverHandler.SetPWM(1, int.Parse(readedValue));
            }
        }
예제 #2
0
        private static void DoPWM(IWrapI2C i2cWrapper, ILogger logger, ITimer timer, int address)
        {
            var driverHandler = new ServoDriver(i2cWrapper, address, logger, timer);

            driverHandler.Configure();
            driverHandler.Reset();
            Console.WriteLine($"Obtained hanlder: {driverHandler}");
            Console.ReadKey();

            string readedValue;

            while (true)
            {
                Console.WriteLine("Give me value:");
                readedValue = Console.ReadLine();

                if (string.IsNullOrEmpty(readedValue))
                {
                    break;
                }

                driverHandler.SetPWM(1, int.Parse(readedValue));
            }
        }