Example #1
0
        static void Main(string[] argv)
        {
            try
            {
                Console.WriteLine("Starting Communication with VCNL4000");
                var vcnl4000 = new VCNL4000("1", 100);
                vcnl4000.ProximityReading += sensor_ProximityReading;
                var productId = vcnl4000.ProductID;
                OutputValue(productId, "Product ID");
                vcnl4000.Start();

                //Console.WriteLine("Starting Communication with ADS1115");
                //var ads1115 = new ADS1115("1");
                //ads1115.Message += ads1115_Message;
                //ads1115.SingleEndedConversionReading += ads1115_ConversionReading;
                //ads1115.Start();

                Console.WriteLine("Press Esc key to stop");
                do
                {
                    while (!Console.KeyAvailable)
                    {
                        // Do something
                    }
                } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

                //ads1115.Stop();
                vcnl4000.Stop();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Example #2
0
        static void Main(string[] argv)
        {
            try
            {
                Console.WriteLine("Starting Communication with VCNL4000");
                var vcnl4000 = new VCNL4000("1", 100);
                vcnl4000.ProximityReading += sensor_ProximityReading;
                var productId = vcnl4000.ProductID;
                OutputValue(productId, "Product ID");
                vcnl4000.Start();

                //Console.WriteLine("Starting Communication with ADS1115");
                //var ads1115 = new ADS1115("1");
                //ads1115.Message += ads1115_Message;
                //ads1115.SingleEndedConversionReading += ads1115_ConversionReading;
                //ads1115.Start();                

                Console.WriteLine("Press Esc key to stop");
                do
                {
                    while (!Console.KeyAvailable)
                    {
                        // Do something
                    }
                } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

                //ads1115.Stop();
                vcnl4000.Stop();

     
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }