daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.IO.Ports;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using UnityEngine;
  5.  
  6. public class ArduinoReader : MonoBehaviour
  7. {
  8.     public ElevatorSystem _elSys;
  9.     private SerialPort sPort;
  10.  
  11.     void Start()
  12.     {
  13.         sPort = new SerialPort("COM8");
  14.         sPort.Open();          
  15.     }
  16.  
  17.     public void FixedUpdate()
  18.     {
  19.         if (sPort.BytesToRead > 0)
  20.         {
  21.             string msg = sPort.ReadLine();
  22.             _elSys.FindNewCard(msg);
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top