Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO.Ports;
- using System.Threading;
- using System.Threading.Tasks;
- using UnityEngine;
- public class ArduinoReader : MonoBehaviour
- {
- public ElevatorSystem _elSys;
- private SerialPort sPort;
- void Start()
- {
- sPort = new SerialPort("COM8");
- sPort.Open();
- }
- public void FixedUpdate()
- {
- if (sPort.BytesToRead > 0)
- {
- string msg = sPort.ReadLine();
- _elSys.FindNewCard(msg);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement