bool yellow = false; //just have to make sure it starts the same as on the Arduino void Start() { arduinoConnector = GetComponent <ArduinoConnector>(); //to access properties of ArduinoConnector script arduinoConnector.Open(); //open serial connection rend = GetComponent <Renderer>(); //to access the renderer of the object rend.material.SetColor("_Color", Color.blue); //set the color of the cube to BLUE }
// Use this for initialization void Start() { arm = GetComponent <GameObject>(); wrist = GameObject.FindObjectOfType(typeof(WristControl)) as WristControl; auriculaire = GameObject.FindObjectOfType(typeof(AuriculaireControl)) as AuriculaireControl; ringFinger = GameObject.FindObjectOfType(typeof(RingControl)) as RingControl; middleFinger = GameObject.FindObjectOfType(typeof(MiddleControl)) as MiddleControl; index = GameObject.FindObjectOfType(typeof(IndexControl)) as IndexControl; thumb = GameObject.FindObjectOfType(typeof(ThumbControl)) as ThumbControl; fingers = new List <Finger>(); fingers.Add(auriculaire); fingers.Add(ringFinger); fingers.Add(middleFinger); fingers.Add(index); fingers.Add(thumb); tempFingerDegree = 255; connector = new ArduinoConnector(); Debug.Log(connector.port); connector.Open(); connector.MoveFinger(31, 90); StartCoroutine(ArduinoEvent()); }
private void OnMouseDown() { print("ball 1 collision"); // a.WriteToArduino("PING1"); // print(a.ReadFromArduino(1000)); ArduinoConnector.ping1(); }
private void OnMouseDown() { print("ball 2 collision"); // x.WriteToArduino("PING2"); // print(x.ReadFromArduino(1000)); ArduinoConnector.ping2(); }
public IEnumerable <string> GetPorts() { try { ArduinoConnector com = new ArduinoConnector(); return(com.PortNames()); } catch (Exception ex) { return(null); } }
static void Main(string[] args) { ArduinoConnector com = new ArduinoConnector(); foreach (var item in com.PortNames()) { Console.WriteLine(item); } Console.WriteLine(com.PortConnect("COM1")); Console.WriteLine(com.WriteToPort("COM1", "la vai...")); Console.WriteLine(com.ReadFromPort("COM1")); Console.ReadKey(); }
public int SetCommands(string port, [FromBody] dynamic comando) { try { ArduinoConnector com = new ArduinoConnector(); com.PortConnect(port); return(com.WriteToPort(data: comando.comando.ToString())); } catch (Exception ex) { return(-1); } }
// Use this for initialization void Start() { arduino = FindObjectOfType <ArduinoConnector>(); startPosition = transform.position; rend = GetComponentsInChildren <Renderer>(); //if (arduino != null) //{ // arduino.EnableHapticFeedback(false); // arduino.AdjustHapticFeedback(intensity); // //oldIntensity = intensity; //} }
private void sendToSerial(string code) //tady davam serial pro arduino { Debug.Log(code); if (connector == null) { connector = gameObject.AddComponent <ArduinoConnector>(); } string sound; switch (code) { case ("SVETLO25"): sound = "SoundAura"; break; case ("SVETLO50"): sound = "SoundMagic"; break; case ("SVETLO75"): sound = "SoundMagic"; break; case ("SVETLO"): sound = "SoundUnlock"; break; default: sound = "SoundFail"; GameObject.Find("SoundAura").GetComponent <AudioSource>().Stop(); break; } GameObject.Find("SoundMagic").GetComponent <AudioSource>().Stop(); GameObject.Find("SoundFail").GetComponent <AudioSource>().Stop(); GameObject.Find(sound).GetComponent <AudioSource>().Play(); connector.WriteToArduino(code); }
public IActionResult PerformAction([FromBody] ComponentDto component) { var comp = _repository.Component.GetComponentById(component.id); var cat = _repository.Category.GetCategoryById(comp.Categoryid); ArduinoConnector connection = new ArduinoConnector(); bool succes = false; succes = connection.Send_Data(comp, cat); if (succes) { comp.value = comp.value == 0?1:0; _repository.Component.UpdateComponent(comp); _repository.Save(); return(Ok("action succesfull")); } return(StatusCode(500, "Internal server error")); }
// Use this for initialization void Start() { a = gameObject.AddComponent <ArduinoConnector>(); a.Open(); }
// Use this for initialization void Start() { arduinoConnector = GetComponent <ArduinoConnector>(); //to access properties of ArduinoConnector script arduinoConnector.Open(); //open serial connection arduinoConnector.ReadByteFromArduinoAsync(arduinoRead); //read from Arduino }
// Start is called before the first frame update void Start() { connector = GetComponent <ArduinoConnector>(); rb = GetComponent <Rigidbody>(); }
public void Start() { arduino = ArduinoConnector.GetComponent <ArduinoConnector>(); //this is used to connect into arduino board }
private void Start() { communicator = GetComponent <ArduinoConnector>(); }
void Start() { ac = arduinoConnector.GetComponent <ArduinoConnector>(); }