Reading outputs


I'm trying to read the outputs of a joystick, specifically the vectors x and y.

28/10/2021 23:04:02node: eeebad4a29142066
rested : msg : Object
payload: object
angle: object
direction: object
distance: 0
vector: object
x: 0
y: 0
topic: "rested"
socketid: "uf2ZCeo6yMHJHHDTAAAd"
_msgid: "2daacabf5c529c8c"

and I'm doing it with this function:

    msg.payload = msg.payload[0][3]['x'];
return msg;

I appreciate if someone can correct me.

There is great documentation available which explains how this works.

Thanks, I made some improvements with the code. The joystick jumps to the right when I click on it with the cursor. Is there a way to tighten its movements?

if(msg.topic != 'rested'){
  msgY = {payload : msg.payload.vector.y};
  msgX = {payload : msg.payload.vector.x};
return [msgX, msgY];

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.