Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5.  
  6. public class SerialHandler : MonoBehaviour
  7. {
  8. SerialPortUtility.SerialPortUtilityPro serialPort;
  9.  
  10. void Awake()
  11. {
  12. serialPort = this.GetComponent<SerialPortUtility.SerialPortUtilityPro>();
  13. }
  14.  
  15. public void Update()
  16. {
  17. if (serialPort != null)
  18. {
  19. if (Input.GetKey(KeyCode.A))
  20. {
  21. serialPort.WriteCR("1");
  22.  
  23. } else if (Input.GetKey(KeyCode.S)) {
  24. serialPort.WriteCR("0");
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement