C
C#2y ago
Boson

❔ Serial Communication

Hi. Nothing is being printed to the console and I have no idea why.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class ArduinoController : MonoBehaviour
{
SerialPort serial;

void Start() //called once when the program is run
{
serial = new SerialPort("COM3", 9600);
serial.Open();
}

void Update() //called once every frame
{
string data = serial.ReadLine();
Debug.Log(data);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class ArduinoController : MonoBehaviour
{
SerialPort serial;

void Start() //called once when the program is run
{
serial = new SerialPort("COM3", 9600);
serial.Open();
}

void Update() //called once every frame
{
string data = serial.ReadLine();
Debug.Log(data);
}
}
2 Replies
Boson
Boson2y ago
I have checked data is being sent on the COM3 port correctly juat nothing is being read
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.