public void ValueChangeCheck() { Mover mv = FindObjectOfType <Mover>(); if (mv) { mv.rottationSpeed = slider.value; } PlayerPrefs.SetFloat("PSpeed", slider.value); SendToArduino sendToArduino = FindObjectOfType <SendToArduino>(); sendToArduino.speed = slider.value.Remap(0, 80, 200, 600); PlayerPrefs.SetFloat("Arduino", sendToArduino.speed); }
public void InitTransmitter() { string path = GetSourceFile(); Console.WriteLine("reading data from file..."); var data = new ReadSubfile().GetDataFromFile(path); Console.WriteLine("done"); //get port var ports = SerialPort.GetPortNames(); string port; if (ports.Length == 1) { port = ports.First(); } else { WriteAvailablePorts(); Console.WriteLine("please enter com port: "); port = Console.ReadLine(); } SendToArduino sendToArduino = new SendToArduino(port, data); }