Exemple #1
0
        private static async Task Toggle(XBeeSeries2 node, int iteration)
        {
            Console.WriteLine(iteration);
            await node.SetInputOutputConfigurationAsync(InputOutputChannel.Channel4, InputOutputConfiguration.DigitalLow);

            await node.SetInputOutputConfigurationAsync(InputOutputChannel.Channel4, InputOutputConfiguration.Disabled);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //var controllerTask = XBeeController.FindAndOpenAsync(9600);
            //controllerTask.Wait();
            //var controller = controllerTask.Result;

            Task.Run(async() =>
            {
                var controller = new XBeeController();
                await controller.OpenAsync("COM3", 115200);

                var s2     = new XBeeSeries2(controller);
                var serial = await s2.GetSerialNumberAsync();
                Console.WriteLine(serial);
                s2.SampleReceived += (sender, eventArgs) => Console.WriteLine("SAMPLE ---------------");
                await s2.SetInputOutputConfigurationAsync(InputOutputChannel.Channel0,
                                                          InputOutputConfiguration.DigitalIn);
                await s2.SetSampleRateAsync(TimeSpan.FromSeconds(3));
                await s2.ForceSampleAsync();
            });

            Console.ReadKey();
        }