ofxSimpleSerial + arduino mega


I’m trying to communicate between an arduino mega (from arduino.org, NOT arduino.cc) and OF using ofxSimpleSerial. Unfortunately I’m not getting anything. I’ve tried the arduino IDE serial monitor, Serial (app for OSX) and CoolTerm (app for OSX). All of them display data from the arduino mega. Unfortunately I’m not getting anything with OF. I’ve tried an UNO with the same code and I’m getting data from the UNO.

Perhaps anyone’s faced a similar issue?

Here’s a sample of the code:

in setup:

vector <ofSerialDeviceInfo> deviceList = serial.getDeviceList();

int baud = 9600;
serial.setup("/dev/cu.usbmodem1411", baud); //open the first device

message = "";

and the message function:

void ofApp::onNewMessage(string & message) { cout << "onNewMessage, message: " << message << "\n"; }
So pretty straightforward I’d say.

can you just use the ofSerial that comes with OF to communicate with the device? im just trying to limit the confounds here.

just do:

//in setup function 
boolean hasSerial = serial.setup("your device path", 9600);

//in update function
unsigned char buffer[64];
if (hasSerial){
	if (serial.readBytes(buffer, 1) > 0){
		speed = 2.05;

I ended up using ofxSerial in the end, that seemed to do the job quite nicely.