Download

Serial COM port communication with UrealEngine

Need some advice from You in the next steps of realization. First at all ive made simple serial communication soft for windows. It works great. Now we need to make implementation of this in UnrealEngine
This is the code of new cpp class in engine:



// Fill out your copyright notice in the Description page of Project Settings.

#include "rs232_communication.h"
#include "SerialCommunication.h"

#include <stdio.h>
#include <conio.h>
#include "tserial.h"



// Sets default values
ASerialCommunication::ASerialCommunication()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void ASerialCommunication::BeginPlay()
{
	Super::BeginPlay();

	Tserial *com;
	com = new Tserial();

	if (com != 0)
	{
		com->connect("COM5", 9600, spNONE);

		// ------------------
		printf("Hello World 
");
		// ------------------

		com->sendChar((char)c);

		com->disconnect();

		// ------------------
		delete com;
		com = 0;
	}

}

// Called every frame
void ASerialCommunication::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}


When Ive trying to compile in engine:


tserial.cpp' is trying to include the file 'stdio.h' as the precompiled header, but that file could not be located in any of the module's include search paths.

tserial.h and tserial.cpp included to the vs2015 project. My simple soft include this additional files without any warnings, but here we have some difficulties.

*serial port libraries ive get from here Developer's corner

PS. I know that there is plugin for serial communication UE4Duino - Arduino to UE4 plugin Release! - Community Content, Tools and Tutorials - Unreal Engine Forums
BUT problm is that we can only sent info from engine, receiving isnt working for some reasons (my post: UE4Duino - Arduino to UE4 plugin Release! - Community Content, Tools and Tutorials - Unreal Engine Forums). Also I want to increase C++ skills and it would be good lesson for me.

Hello from Ukraine :slight_smile:

Hi! The UE4Duino plugin for serial communication is wondeful and convenient to use, but I have the same problem as you described, and the project cannot be packed now. Can you receive data now?