A plugin for serial data reading in Godot Engine 4.3, aimed at bridging communication between devices like Arduino and Godot to create dynamic interactions in games and applications.
GDSerialRead offers a straightforward solution for reading serial data directly in Godot, making it ideal for integrating external devices like Arduino with the engine. This project was initially developed to simulate and capture data from an Arduino Esplora in a Linux environment, enabling real-world hardware and software interactions in a game environment.
- Godot Engine - .NET 4.3 or higher.
- SDK do .NET 8 version usade in project.
- Build System.IO.Ports in project paste: ```dotnet add package System.IO.Ports``
Project --> Tools --> C# --> Creat C# solution
2. After initializing the environment, open a terminal with the path to the main folder of the Godot project
git clone https://github.com/NicolasRaf/GDSerialRead.git
dotnet add package System.IO.Ports
5. Now inside Godot open the scene called “DataReceiver.tscn” and assign the script “DataReceiver.gd” to the node
7. After that, the program is up and running and you can receive and manipulate data from the “DataReciever.gd” node
The node DataReceiver is responsible for receiving and processing the data sent from the SerialRead node. To utilize this functionality, ensure that both this scene (DataReceiver.gd) and the SerialRead.cs script are set as Global (Autoload) in your project.
- Call
SerialRead.StartReading()to begin reading data from the serial port. - Call
SerialRead._ExitTree()to stop reading data and properly close the connection.
- The script automatically starts reading data when the node is initialized.
- If you stop the reading process, it will not resume until you explicitly call
StartReading()again. - The code attempts to connect to a serial port only when data is being sent.
- If access to the port is unavailable or if no data is received for 3 seconds, the script will attempt to connect to the next available port.
- This node serves as a manager for the incoming data, allowing you to process and store it as needed.
- You can create additional variables to hold the parsed or transformed data as necessary.
This functionality only works if both this node and the SerialRead.cs script are configured as Autoloads in your project settings.
-
Switch to the
example/TestSerialExamplebranch. -
It has a project already installed for testing the reception of serial data.






