How to communicate arduino and OF?

I use GY801(gyro, accelerometer, magnetic) sensor and i got (pitch, roll, yaw) in arduino.

I use ATmega2560 board and i connect scl, sda(not analog pin bc i can’t get data with analog pin) with board and sensor.
and now i connect computer and board with usb.

Arduino code

#include <Wire.h>
#include <GY80.h>

GY80 sensor = GY80(); //create GY80 instance

float rollGyro, pitchGyro,yawGyro, yawZ;
float rollAcc,pitchAcc, yawAcc;
float yawMg;
float pitch=0.0, roll=0.0;
float yaw=0.0;
float DT = 0.01;

void setup()

// initialize serial communication at 115200 bits per second:


sensor.begin();       //initialize sensors


void loop()


GY80_scaled val = sensor.read_scaled();       //get values from all sensors

pitchAcc = atan2(val.a_y, val.a_z)*180/PI;
rollAcc = -atan2(val.a_x, val.a_z)*180/PI;

pitchGyro = val.g_x/131.07;
yawGyro = val.g_z/131.07;

yawMg = atan2(val.m_y, val.m_x)*180/PI+180;

pitch = (0.05*(pitch+(pitchGyroDT)))+(0.95pitchAcc);
roll = (0.05*(roll+(rollGyroDT)))+(0.95rollAcc);
yaw = (0.05*(yaw+(yawGyroDT)))+(0.95yawMg);

Serial.print(" pitch: “); Serial.print(pitch);
Serial.print(” roll: “); Serial.print(roll);
Serial.print(” yaw: "); Serial.println(yaw);

delay(250); // delay in between reads for stability


Openframeworks code

#include “ofApp.h”

void ofApp::setup() {

bSendSerialMessage = false;

int baud = 9600;
serial.setup("COM3", baud); 


void ofApp::update() {

unsigned char myByte = 0;

myByte = serial.readByte();

if (myByte == OF_SERIAL_NO_DATA) {
	cout << "no data was read";
else if (myByte == OF_SERIAL_ERROR) {
	cout << "an error occurred";
else {
	cout << "myByte is " << myByte << "\n";


I want to use pitch, roll, yaw values in openframeworks
How can i do??

Are you getting no values right now? Are you getting “no data” or “an error” or are you getting values but you just need to separate out which is which?

If you are getting no values you might consider switching over to using the arduino firmata approach.
I had a bit of trouble with serial communication between arduino and OF a while back and I wasn’t having much luck trouble shooting it so I switched over to using the firmata. That has been working robustly for several months now on an exhibit that has been running continuously.

Thank you to reply!!

For example i got data in Arduino like this
pitch: 40 roll: 10 yaw: 210

but in OF i got data like ths


OF just show me the all data in serial monitor
but i want to get and use separating values.

If i use firmata how can i use this??
Actually i try to use firmata but i need pin number
but i only use 3v, GND, SCL(21), SDA(20) and USB.
so i can’t know how can use firmata.