Sent data from library to scetch

Hello,
I have the library for my USB Host Shield. In the demo code data from Joystick printed fom library to Port.monitor, but I need to use it in my scetch. How to do this.
In the library: (hidjoystickptparser.cpp)

        Serial.print("X: ");
	PrintHex<uint8_t>(evt->X, 0x80);
	Serial.print("\tY: ");
	PrintHex<uint8_t>(evt->Y, 0x80);
	Serial.print("\tZ: ");
	PrintHex<uint8_t>(evt->Z1, 0x80);
	Serial.print("\tZ: ");
	PrintHex<uint8_t>(evt->Z2, 0x80);
	Serial.print("\tRz: ");
	PrintHex<uint8_t>(evt->Rz, 0x80);
	Serial.println("");

in the scetch: :slight_smile: nothing

      void loop()
      {
             Usb.Task();
      }

So i need to send data to scetch and use it) Thank you and sorry for my bad English/

So i need to send data to scetch and use it

The sketch, through some mysterious library function you posted only a snippet of, already has access to the data. If you had actually read the sticky at the top of the forum, you'd have seen that you need to post ALL of your code.

Get started with libraries:

http://arduino.cc/en/Reference/Libraries

Have fun,

Ray

PaulS:

So i need to send data to scetch and use it

The sketch, through some mysterious library function you posted only a snippet of, already has access to the data. If you had actually read the sticky at the top of the forum, you'd have seen that you need to post ALL of your code.

Okay, https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/HID/USBHIDJoystick -there is all code.

DiA_ru: i need to send data to scetch and use it)

You're looking at the problem backwards. The library doesn't send data to the sketch - the sketch retrieves data from the library when it needs it. Usually, libraries are designed to do a particular job and provide a callable API which enables sketches to use them to do that job. In this case the code fragment you posted shows that the library API provides an object oriented interface which exposes some properties and shows how to use access them as evt->X, evt->Y, evt->Z1 and so on.