Exemplo n.º 1
0
        public TrainDrukteForm()
        {
            InitializeComponent();
            timer1.Start();

            _arduino = null;
            _ledControl = null;

            _byteViewer = new ByteViewer();
            _byteViewer.Dock = DockStyle.Fill;
            panel1.Controls.Add(_byteViewer);

            _trackBars = new TrackBar[6]{ tb1, tb2, tb3, tb4, tb5, tb6 };
            _colorCodes = new Color[3] { Color.White, Color.Green, Color.Red };

            SetBarsState(false);

            foreach (TrackBar bar in _trackBars)
            {
                bar.ValueChanged += bars_ValueChanged;
            }

            _trafficStates = new Color[6];

            Messages = new List<Message>();

            cbCom.Items.AddRange(SerialPort.GetPortNames());
        }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        _arduino = Arduino.global;
          _arduino.Setup(ArduinoSetup);

          StartCoroutine(BlinkLoop());
    }
Exemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
           /* foreach (var k in AndroidSerialPort.EnumerateSerialPorts().Keys)
                MessageBox.Show(k + ":" + AndroidSerialPort.EnumerateSerialPorts()[k]);
            */
            Timer t = new Timer(50);
            t.Elapsed += T_Elapsed;
            Timer t2 = new Timer(200);
            t2.Elapsed += T2_Elapsed;
            arduino1 = new Arduino<UnitySerialPort.AndroidSerialPort>(BoardType.UNO);
            //arduino2 = new Arduino(BoardType.UNO);

            try
            {
                //arduino2.pinMode(13, PinMode.OUTPUT);
                /*arduino.pinMode(12, PinMode.OUTPUT);
                arduino.pinMode(7, PinMode.INPUT_PULLUP);*/
                //arduino.pinMode(12, PinMode.OUTPUT);
                var sp = new SerialPort("COM7", 9600, SerialPortNET.Parity.None, 8, SerialPortNET.StopBits.One);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //t.Start();
            //t2.Start();
        }
 public ArduinoWrapper(string Port)
 {
     board = new Arduino(Port);
     led13 = new Led(board,13);
     led12 = new Led(board,12);
     led11 = new Led(board,11);
 }
Exemplo n.º 5
0
	void Start () 
	{
		arduino = Arduino.global;
		arduino.Log = (s) => Debug.Log("Arduino: " +s);
		arduino.Setup(ConfigurePins);
		switchColor(false);
	}
Exemplo n.º 6
0
        public TrainStationProcessor(System.Windows.Forms.Label label)
        {
            rand = new Random();

            ip = "localhost:8000";

            if(!File.Exists("ip.txt"))
            {
                File.Create("ip.txt");
            }
            if(File.Exists("ip.txt"))
            {
                try
                {
                    string temp = File.ReadAllText("ip.txt");
                    if (!string.IsNullOrEmpty(temp) && !string.IsNullOrWhiteSpace(temp) && temp.Length > 2)
                    {
                        ip = temp;
                    }
                }
                catch(Exception)
                {

                }
            }

            if (!localOnly)
            {
                _service = new TrafficMessageClient("BasicHttpBinding_ITrafficMessage", "http://" + ip + "/MEX/MessageService");
                //_service = new TrafficMessageClient();

                _inMessage = new ServerMessage();
                _outMessage = new ServerMessage();
            }

            string[] comports = System.IO.Ports.SerialPort.GetPortNames();
            if (comports.Length > 0)
            {
                _arduino = new Arduino(0, System.IO.Ports.SerialPort.GetPortNames()[0]);
                _ledControl = new LedControl(_arduino, 6, 50);
                try
                {
                    _arduino.Connect();
                    _ledControl.InitializeLedStrip();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            //_timer = new Timer(500.0);
            //_timer.Elapsed += Tick;
            _timer = new System.Windows.Forms.Timer();
            _timer.Interval = 127;
            _timer.Tick += _timer_Tick;
            _timer.Enabled = true;
            _timer.Start();
        }
    void Start()
    {
        getInstance = this;
        readByte = 0x00;

        arduino = Arduino.global;
        arduino.Setup(ConfigurePins);
    }
Exemplo n.º 8
0
        public LedControl(Arduino arduino, byte pin, byte amountOfLeds)
        {
            this.MaxLeds = amountOfLeds;
            this._pin = pin;

            _arduino = arduino;
            _controlMessage = new Message();
        }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {

        arduino = Arduino.global;
        arduino.Log = (s) => Debug.Log("Arduino: " + s);

        arduino.Setup(ConfigurePins);

        ConfigurePins();
        //StartCoroutine(BlinkLoop());
    }
Exemplo n.º 10
0
 void Start( )
 {
     personThere = true;
     breathSensorInitialized = false;
     min = 5000;
     max = 0;
     arduino = GameObject.Find ("Uniduino(Clone)").GetComponent<Arduino>();
     breathingOut = 0;
     //	arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
     previousPinValue = 0;
     iterator = 0;
     StartCoroutine (InitiateBreathSensor());
 }
Exemplo n.º 11
0
        private void CopyArduinoFolder(Arduino arduino, string folder)
        {
            var folderName = Path.Combine(folder, arduino.Name);

            CopyFolderCore(folderName, () => GetClientFileContent(arduino), arduino.Name + ".Ino");

            var clientFolderSource = Path.Combine(Directory.GetCurrentDirectory(), "GeneratorSource", "Client");
            var destinationFolder = Path.Combine(folder, arduino.Name);

            foreach (var clientFile in Directory.GetFiles(clientFolderSource))
            {
                File.Copy(clientFile, Path.Combine(destinationFolder, Path.GetFileName(clientFile)));
            }
        }
Exemplo n.º 12
0
        public void LoadSettings()
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(Arduino.GetType());

                using (StreamReader sw = new StreamReader("Startup.xml"))
                {
                    Arduino = (Arduino)serializer.Deserialize(sw);
                }
            }
            catch (Exception ex)
            {
                Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message);
            }
        }
 // Use this for initialization
 void Start()
 {
     arduino = Arduino.global;
 }
 void Start()
 {
     singleton = this;
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
 }
 void Start()
 {
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
     StartCoroutine(BlinkLoop());
 }
Exemplo n.º 16
0
 // Button knob 0 ~ 1024 > 10 ~ 1010
 // Start is called before the first frame update
 void Start()
 {
     arduino = GameObject.FindGameObjectWithTag("Cube").GetComponent <Arduino>();
 }
Exemplo n.º 17
0
 void Start()
 {
     _arduino = Arduino.global;
       if(_arduino != null)
      _arduino.Setup(ArduinoSetup);
 }
Exemplo n.º 18
0
 private void button5_Click(object sender, EventArgs e)
 {
     arduino = new Arduino((string)comboBox2.SelectedItem);
     checkBox1.Enabled = true;
 }
Exemplo n.º 19
0
	void Start () 
	{
		arduino = Arduino.global;
		arduino.Setup(ConfigurePins);
		lastTime = Time.time * 1000;
	}
Exemplo n.º 20
0
 void Start()
 {
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
     lastTime = Time.time * 1000;
 }
Exemplo n.º 21
0
 private void button1_Click(object sender, EventArgs e)
 {
     Arduino.WriteLine("1");
 }
Exemplo n.º 22
0
 protected internal void SetXVal(AX12RegisterAdd add, byte val, Arduino.Communication.DataAccess.ArduinoBus.currentSysexCallback callback)
 {
     lock (lockref)
     {
         if (callback == null)
         {
             _busarduino.SendWriteInstructionMessage(_identifiant_dynamixel, _busarduino.GetAX12Register(add), new byte[] { val });
         }
         else
         {
             _busarduino.SendWriteInstructionMessage(_identifiant_dynamixel, _busarduino.GetAX12Register(add), new byte[] { val }, callback);
         }
     }
 }
Exemplo n.º 23
0
        private Arduino MergeArduino(Arduino prevArduino, Arduino arduino)
        {
            var result = new Arduino(prevArduino.Name);

            var pinNumber = START_PIN_NUMBER_LIGHT;
            foreach (var device in prevArduino.Devices.Where(device => device.DeviceType == DeviceType.LightSwitchDeviceType.ToString())
                .Union(arduino.Devices.Where(device => device.DeviceType == DeviceType.LightSwitchDeviceType.ToString())))
            {
                device.PinNumber = (pinNumber).ToString(CultureInfo.InvariantCulture);
                pinNumber++;
                result.AddDevice(device);
            }

            pinNumber = START_PIN_NUMBER_RELAY;
            foreach (var device in prevArduino.Devices.Where(device => device.DeviceType == DeviceType.RelayDeviceType.ToString())
                .Union(arduino.Devices.Where(device => device.DeviceType == DeviceType.RelayDeviceType.ToString())))
            {
                device.PinNumber = (pinNumber).ToString(CultureInfo.InvariantCulture);
                pinNumber++;
                result.AddDevice(device);
            }

            return result;
        }
Exemplo n.º 24
0
        void StartDeepUVFluorescence(int index)
        {
            indexUV = index;
            if (index == 0)
            {
                if (CheckSaveFileExists("_UV.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                    GlobalVariables.globalSettings.SaveFolderName = saveDlg.SaveFolderName;
                }
            }
            else if (index == 1)
            {
                if (CheckSaveFileExists("_UV2.bmp"))
                {
                    var saveDlg = new View.SaveFolderWindow(_saveFolderName, "_UV2.bmp");
                    saveDlg.ShowDialog();
                    if (!saveDlg.SaveFolderNameSet)
                    {
                        return;
                    }
                    _saveFolderName = saveDlg.SaveFolderName;
                }
            }

            //var res = MessageBox.Show("Please confirm that the deep UV is on and then press OK to continue.", "Deep UV On",
            //    MessageBoxButton.OKCancel);

            //if (res == MessageBoxResult.Cancel)
            //    return;
            // TODO: arduino light on
            if (!Arduino.FluorescenceOn())
            {
                _cameraVM.AbortDeepUVFluorescence();

                MessageBox.Show("Serial Port Error... You may have to reset the camera.", "Aborting...");

                return;
            }

            Callback WhenMeasurementEnds = DeepUVFluorescenceCompleteCallback;

            _camPhosResults = new CamPhosResults(0, new List <PtGreyCameraImage>());
            string error = "";
            // TODO: settings for deep uv
            List <double> shutterTimes = Properties.Settings.Default.DeepUVFlMeasurementShutterTimes.Split(',').
                                         Select(r => Convert.ToDouble(r)).ToList();

            _camPhosActive = _cameraVM.StartDeepUVFluorescence(shutterTimes, Properties.Settings.Default.DeepUVFlMeasurementGain,
                                                               WhenMeasurementEnds, out error);

            if (!_camPhosActive)
            {
                MessageBox.Show(error, "Image Capture not started");
                return;
            }

            if (index == 0)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL;
            }
            else if (index == 1)
            {
                _measurementMode = MEASUREMENT_MODE.DP_FL2;
            }

            _statusVM.Busy++;
            DateTime timestamp = DateTime.Now;
            var      sts       = new StatusMessage {
                Timestamp = timestamp, Message = "Image capture is active."
            };

            _statusVM.Messages.Add(sts);
            _timestamps.Push(timestamp);
        }
Exemplo n.º 25
0
        private async Task TestArduino()
        {
            // ***
            // *** Initialize the Arduino library
            // ***
            IArduino arduino = new Arduino(0x04);
            await arduino.InitializeAsync();

            Arduino.ReadDelayTime = 1500;

            // ***
            // *** Note the Arduino.FirstCustomRegisterId + 0 should match the
            // *** Rpi2Bridge.registerCommand(FIRST_CUSTOM_REGISTER_ID + 0, 2, getDhtReading, NULL);
            // *** command in setup().Change the value of 0 to any value depending on the number of
            // *** custom commands (ensure each register ID is unique).
            // ***
            byte[] result = await arduino.CustomCommandAsync(Arduino.FirstCustomRegisterId + 0, new byte[0], 9);

            if (result[0] == 0)
            {
                float humidity    = BitConverter.ToSingle(result, 1);
                float temperature = BitConverter.ToSingle(result, 5);
            }
            else
            {
                // ***
                // *** Map your custom errors
                // ***
                switch (result[0])
                {
                case 1:
                    throw new ArduinoException("DHT11 checksum error.");

                case 2:
                    throw new ArduinoException("DHT11 timeout.");

                case 3:
                    throw new ArduinoException("DHT11 failed to connect.");

                case 4:
                    throw new ArduinoException("DHT11 failed to acknowledge request.");

                case 5:
                    throw new ArduinoException("DHT11 failed to acknowledge request.");
                }
            }

            await arduino.AnalogWriteAsync(9, 25);

            await arduino.AnalogWriteAsync(10, 200);

            await arduino.AnalogWriteAsync(11, 45);

            await Task.Delay(5000);

            await arduino.AnalogWriteAsync(9, 110);

            await arduino.AnalogWriteAsync(10, 50);

            await arduino.AnalogWriteAsync(11, 145);

            await Task.Delay(5000);

            await arduino.AnalogWriteAsync(9, 255);

            await arduino.AnalogWriteAsync(10, 255);

            await arduino.AnalogWriteAsync(11, 255);
        }
Exemplo n.º 26
0
 void Start()
 {
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
 }
Exemplo n.º 27
0
 public Form2()
 {
     InitializeComponent();
     Arduino.Open();
     MessageBox.Show("Arduino Connected");
 }
Exemplo n.º 28
0
        public void Evaluate(int SpreadMax)
        {
            double enable  = 0;
            double comport = 0;

            //the variables to fill with the input data
            double setDigital    = 0;
            double configDigital = 0;
            double configPWM     = 0;

            // setup digital inputs and outputs depending on pin settings



            // request Pins Enable and ComPort and create Connection to Arduino
            EnablePlugin.GetValue(0, out enable);
            SetComPort.GetValue(0, out comport);
            //&& myarduino == null
            if (enable == 1 && myarduino == null)
            {
                myarduino = new Arduino("COM" + comport);
                // initially setup digital inputs and outputs depending on pin settings
                for (int i = 0; i < 12; i++)
                {
                    ConfigureDigital.GetValue(i, out configDigital);
                    ConfigurePWM.GetValue(i, out configPWM);
                    if (configDigital == 0 && configPWM == 0)
                    {
                        myarduino.pinMode(i + 2, Arduino.INPUT);
                    }
                    if (configDigital == 1 || configPWM == 1)
                    {
                        myarduino.pinMode(i + 2, Arduino.OUTPUT);
                    }
                }
            }
            //destroy connection on disable
            if (enable == 0 && myarduino != null)
            {
                for (int i = 0; i < 12; i++)
                {
                    myarduino.digitalWrite(i + 2, Arduino.LOW);
                    myarduino.analogWrite(i + 2, 0);
                }
                myarduino.Close();
                myarduino = null;
            }


            //set slicecounts for all outputs
            AnalogIn.SliceCount  = SpreadMax;
            DigitalIn.SliceCount = SpreadMax;

            // this loop executes if plugin is enabled by pin
            if (enable == 1)
            {
                // setup digital inputs and outputs depending on pin settings
                if (ConfigureDigital.PinIsChanged || ConfigurePWM.PinIsChanged)
                {
                    for (int i = 0; i < 12; i++)
                    {
                        ConfigureDigital.GetValue(i, out configDigital);
                        ConfigurePWM.GetValue(i, out configPWM);
                        if (configDigital == 0 && configPWM == 0)
                        {
                            myarduino.pinMode(i + 2, Arduino.INPUT);
                        }
                        if (configDigital == 1 || configPWM == 1)
                        {
                            myarduino.pinMode(i + 2, Arduino.OUTPUT);
                        }
                    }
                }



                for (int i = 0; i < 12; i++)
                {
                    //read data from inputs
                    SetDigitalOut.GetValue(i, out setDigital);
                    ConfigureDigital.GetValue(i, out configDigital);
                    ConfigurePWM.GetValue(i, out configPWM);



                    //read data from digital inputs and set output pin
                    if (configDigital == 0 && configPWM == 0)
                    {
                        DigitalIn.SetValue(i, myarduino.digitalRead(i + 2));
                    }

                    //just set outputs to something when setdigital input pin changed
                    if (SetDigitalOut.PinIsChanged || ConfigureDigital.PinIsChanged || ConfigurePWM.PinIsChanged)
                    {
                        // DIGITALOUT HIGH set digital output to HIGH if settings apply
                        if (configDigital == 1 && configPWM == 0 && setDigital == 1)
                        {
                            myarduino.digitalWrite(i + 2, Arduino.HIGH);
                        }
                        // DIGITALOUT LOW set digital output to LOW if settings apply
                        if (configDigital == 1 && configPWM == 0 && setDigital == 0)
                        {
                            myarduino.digitalWrite(i + 2, Arduino.LOW);
                        }
                        // PWM OUT
                        if (configPWM == 1)
                        {
                            myarduino.analogWrite(i + 2, Convert.ToInt32(setDigital));
                        }
                    }
                }


                // read analog inputs and set output pin of plugin
                for (int i = 0; i < 6; i++)
                {
                    AnalogIn.SetValue(i, myarduino.analogRead(i));
                }
            }
        }
Exemplo n.º 29
0
        internal static void StartTempLogging(bool consolemode, bool logmode, bool dumpmode)
        {
            bool initialized = false;

              if (consolemode)
              {
            Console.Clear();
            Console.Title = "TempServe";
            Console.BufferHeight = Console.WindowHeight = 20;
            Console.BufferWidth = Console.WindowWidth = 80;
            Console.CursorVisible = false;
            Console.WriteLine("Initializing ...");
              }

              SqlCeResultSet rs = null;

              using (var mon = new W83627DHG())
              {
            fc = mon;
            var cpu = new CPU();
            var asp0800 = new SMBus.ASP0800();
            var ard = new Arduino();
            #if NVIDIA
            Debugger.Launch();
            var nv = new NVidiaGPU();
            #endif

            if (consolemode)
            {
              SetConsoleCtrlHandler(
            x =>
            {
              running = false;
              mon.Dispose();
              Console.CursorVisible = true;
              return x != CtrlTypes.CTRL_C_EVENT;
            }
            , true);
            }

            Dictionary<string, Sample> min = null;
            Dictionary<string, Sample> max = null;

            var avg5 = new Queue<Dictionary<string, Sample>>(60);

            var sw = Stopwatch.StartNew();

            while (running)
            {
              var elapsed = sw.Elapsed;

              var alldata = cpu.GetData().
            Concat(mon.GetData()).
            Concat(asp0800.GetData()).
            Concat(ard.GetData()).
            #if NVIDIA
            Concat(nv.GetData()).
            #endif
            ToList();

              var now = DateTime.Now;

              foreach (var smp in alldata)
              {
            smp.Time = now;
              }

              lastsample = alldata;

              if (!initialized)
              {
            if (consolemode)
            {
              var height = alldata.Count + 2;
              Console.BufferHeight = Console.WindowHeight = height;
            }

            if (logmode)
            {
              rs = BuildDatabase(alldata.Where(x => x.Log).ToList());
            }

            initialized = true;
              }

              if (logmode)
              {
            RecordSample(rs, alldata);
              }

              if (dumpmode)
              {
            using (var w = new StringWriter())
            {
              mon.DumpRawByteData(w);
              File.AppendAllText("W83627DHG.log", w.ToString());
            }

            using (var w = new StringWriter())
            {
              mon.DumpSIOByteData(w);
              File.AppendAllText("Super-IO.log", w.ToString());
            }

            //using (var w = new StringWriter())
            //{
            //  asp0800.DumpRawByteData(w);
            //  File.AppendAllText("ASP0800b.log", w.ToString());
            //}

            using (var w = new StringWriter())
            {
              asp0800.DumpRawWordData(w);
              File.AppendAllText("ASP0800w.log", w.ToString());
            }
              }

              if (consolemode)
              {
            Console.Title = string.Format("TempServe - Running for: {3}d {0:00}:{1:00}:{2:00}",
              elapsed.Hours, elapsed.Minutes, elapsed.Seconds, elapsed.Days);

            while (avg5.Count >= 60)
            {
              avg5.Dequeue();
            }

            var hashdata = alldata.ToDictionary(x => x.Name, x => x); ;

            avg5.Enqueue(hashdata);

            if (min == null)
            {
              min = hashdata;
            }
            else
            {
              min = HashMap((x, y) => x.Value > y.Value ? y : x, min, hashdata);
            }

            if (max == null)
            {
              max = hashdata;
            }
            else
            {
              max = HashMap((x, y) => x.Value < y.Value ? y : x, max, hashdata);
            }

            using (var output = new StringWriter())
            {
              output.WriteLine("{0,-18}{1,10}{2,10}{3,10}{4,10}{5,10}{6,10}",
                "Sensor", "Current", "Min", "Max", "Avg(10)", "Avg(30)", "Avg(60)");

              foreach (var s in alldata)
              {
                var avg = avg5.Reverse().ToArray();

                var fs = BuildFormatString(s);

                output.WriteLine(fs, s.Name, s.Value,
                  min[s.Name].Value,
                  max[s.Name].Value,
                  avg.Take(10).Select(x => x[s.Name]).Average(x => x.Value),
                  avg.Take(30).Select(x => x[s.Name]).Average(x => x.Value),
                  avg.Take(60).Select(x => x[s.Name]).Average(x => x.Value)
                  );
              }

              Console.Clear();
              Console.Write(output.ToString());
            }
              }

              var taken = Math.Min((sw.Elapsed - elapsed).TotalMilliseconds, 100) + 3;
              Thread.Sleep(1000 - (int)taken);
            }
              }
        }
Exemplo n.º 30
0
 void Start()
 {
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
 }
Exemplo n.º 31
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     Arduino.Close();
 }
Exemplo n.º 32
0
 public Motor this[Arduino arduino, ArduinoPort port]
 {
     get { return(motors[((int)arduino - 1) * 2 + (int)port]); }
     internal set { motors[((int)arduino - 1) * 2 + (int)port] = value; }
 }
Exemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     print("Is this running?");
     arduino = Arduino.global;
     arduino.Setup(ConfigurePins);
 }
Exemplo n.º 34
0
 private void DestroySerial()
 {
     arduino = null;
     checkBox1.Checked = false;
     checkBox1.Enabled = false;
 }
Exemplo n.º 35
0
 private void OFF_Click(object sender, EventArgs e)
 {
     Arduino.WriteLine("3");
 }
Exemplo n.º 36
0
 protected internal void GetXVal(AX12RegisterAdd add, Arduino.Communication.DataAccess.ArduinoBus.currentSysexCallback callback)
 {
     lock (this.lockref)
     {
         _busarduino.SendReadInstructionMessage(_identifiant_dynamixel, _busarduino.GetAX12Register(add), 0, callback);
     }
 }
Exemplo n.º 37
0
 void Start()
 {
     arduino     = Arduino.global;
     arduino.Log = (s) => Debug.Log("Arduino: " + s);
     arduino.Setup(ConfigurePins);
 }
Exemplo n.º 38
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="add"></param>
 /// <param name="val"></param>
 /// <param name="callback"></param>
 protected internal void SetXVal(AX12RegisterAdd add, int val, Arduino.Communication.DataAccess.ArduinoBus.currentSysexCallback callback)
 {
     lock (this.lockref)
     {
         if (_re == null)
         {
             _busarduino.SendWriteInstructionMessage(_identifiant_dynamixel, _busarduino.GetAX12Register(add), new byte[] { (byte)(val & 0xFF), (byte)((val >> 8) & 0xFF) }, callback);
         }
         else
         {
             _busarduino.SendWriteInstructionMessage(_identifiant_dynamixel, _busarduino.GetAX12Register(add), new byte[] { (byte)(val & 0xFF), (byte)((val >> 8) & 0xFF) });
         }
     }
 }
Exemplo n.º 39
0
 public ClientTemplate(Arduino arduino)
 {
     Arduino = arduino;
 }
Exemplo n.º 40
0
 // Use this for initialization
 void Start()
 {
     print ("Is this running?");
     arduino = Arduino.global;
     arduino.Setup (ConfigurePins);
 }
Exemplo n.º 41
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     SetPorts();
     Arduino = new Arduino();
     LoadSettings();
     Arduino.SetWindow(this);
     Arduino.OpenPort(Arduino.Port);
     Arduino.SetRGB();
     Arduino.SetWindow();
     Arduino.SendRGB();
     comboBoxPort.SelectedIndex = 1;
     if (key.GetValue("LED Controll Panel") == null)
     {
         // The value doesn't exist, the application is not set to run at Startup
         startupCheckBox.IsChecked = false;
     }
     else
     {
         // The value exists, the application is set to run at Startup
         startupCheckBox.IsChecked = true;
     }
 }
Exemplo n.º 42
0
 void Start()
 {
     arduino = new Arduino();
     zapping = GetComponent<Zapping>();
     switchCamera = GetComponent<SwitchCamera>();
 }
Exemplo n.º 43
0
        private void connectbutton_Click(object sender, EventArgs e)
        {
            if (_ledControl == null)
            {
                try
                {
                    _arduino = new Arduino(0, cbCom.SelectedItem.ToString());
                    _ledControl = new LedControl.LedControl(_arduino, 6, (byte)maxLedsNUP.Value);
                }
                catch (IOException exception)
                {
                    MessageBox.Show(exception.Message);
                }
                catch (InvalidOperationException exception)
                {
                    MessageBox.Show(exception.Message);
                }
                if (_arduino != null)
                {
                    _arduino.Connect();
                }
                _ledControl.InitializeLedStrip();
            }

            if (_arduino != null && _ledControl != null && _arduino.IsConnected)
            {
                SetBarsState(true);
                MessageBox.Show("Connected");
            }
        }
Exemplo n.º 44
0
 // Use this for initialization
 void Start()
 {
     _arduino = Arduino.global;
       _arduino.Setup(ArduinoSetup);
 }
Exemplo n.º 45
0
 private void Form1_Load(object sender, EventArgs e)
 {
     tmrCalc.Start();
     Arduino.Open();
 }