Serial port - data sending

Hi,
First of all I couldn’t notice right category to software questions. Have I missed it?

My questions is about serial port. Is there any way to send data from terminal(linux) to the robocore? Does any library support it?

I know you share example about getchar(), but it is not what I need.
Thanks in advance for help.

Hi,

You can use /dev/ttyUSB0 on Linux side to write data to RoboCORE [1] [2], on RoboCORE side you can read data with Serial.read() method or poll if data is available by Serial.available() method.

[1] [ubuntu] Writing to serial port
[2] varesano.net - Ressources et information concernant varesano Resources and Information.

Could you write example? Or it is not so easy and it will take more then few minutes to do this?
What do you mean by RoboCORE [1] [2]? Should I create an array on side of linux then save data to RoboCore[1][2] and then read it with Serial.read()?

int hSerial::read
(void * data, int len, int timeout = 0xffffffff )

Still I dont know how to link together the void* data and linuxs console.

Linux code:
main.cpp (900 Bytes)

hFramework code:

void hMain(void)
{
	sys.setLogDev(&Serial);

	for (;;)
	{
		char d[200];
		int r = Serial.read(d, 200, 1000);
		if (r > 0)
		{
			printf("read %d\r\n", r);
			printf("data: %s\r\n", d);
			LED2.toggle();
		}
	}
}
2 Likes