Exemple #1
0
        public void Clear(String[] args)
        {
            if (Processor != null)
            {
                Processor.Stop();
                Processor = null;
            }

            CommandArduino(new String[] { "0" });
        }
Exemple #2
0
        public void Waveform(String[] args)
        {
            if (Port == null)
            {
                Connect(null);
                if (Port == null)
                {
                    return;
                }
            }

            var mode = Int32.Parse(args[0]);

            if (mode < 1 || mode > 3)
            {
                Console.WriteLine("Invalid Display Mode.");
                return;
            }
            else
            {
                if (mode == 2)
                {
                    if (args.Length != 2)
                    {
                        Console.WriteLine("Invalid argument count. Expected 2, received {0}", args.Length);
                        return;
                    }
                }
                else
                {
                    if (args.Length != 3)
                    {
                        Console.WriteLine("Invalid argument count. Expected 3, received {0}", args.Length);
                        return;
                    }
                }
            }


            CommandArduino(args);

            Processor = new WaveformProcessor(Port);
            Processor.Start();
        }
Exemple #3
0
        public void Perlin(String[] args)
        {
            if (Port == null)
            {
                Connect(null);
                if (Port == null)
                {
                    return;
                }
            }

            var mode = Int32.Parse(args[0]);

            if (mode < 1 || mode > 3)
            {
                Console.WriteLine("Invalid Display Mode.");
                return;
            }
            else
            {
                if (mode == 2)
                {
                    if (args.Length != 2 && args.Length != 6)
                    {
                        Console.WriteLine("Invalid argument count. Expected 2 or 6, received {0}", args.Length);
                        return;
                    }
                }
                else
                {
                    if (args.Length != 3 && args.Length != 6)
                    {
                        Console.WriteLine("Invalid argument count. Expected 3 or 6, received {0}", args.Length);
                        return;
                    }
                }
            }

            if (args.Length == 6)
            {
                PerlinProcessor.OCTAVES = int.Parse(args[3]);
                Console.WriteLine("Perlin Octaves: {0}", PerlinProcessor.OCTAVES);
                PerlinProcessor.X_SCALE = float.Parse(args[4]);
                Console.WriteLine("Perlin X Scale: {0}", PerlinProcessor.X_SCALE);
                PerlinProcessor.T_SCALE = float.Parse(args[5]);
                Console.WriteLine("Perlin Time Scale: {0}", PerlinProcessor.T_SCALE);

                if (mode == 2)
                {
                    CommandArduino(new string[] { args[0], args[1] });
                }
                else
                {
                    CommandArduino(new string[] { args[0], args[1], args[2] });
                }
            }
            else
            {
                CommandArduino(args);
            }

            Processor = new PerlinProcessor(Port);
            Processor.Start();
        }