This works great for sending values to the board through USB, or with Bluetooth (for the Metabot).
There is however an issue when receiving data:
score reports that the data is received in the message window:
Debug: “1\n” (serial_protocol:49)
similarly as when data is sent out witch shows on the message window as follows:
Debug: “1\n” (serial_protocol:90)
The problem is to allocate the value to an address in the Serial Device tree.
The “function onMessage(message)” does not seem to return anything.
I tried adding a “console.log(message)” inside but it had no effect on the message window.
here is the little qml code:
import QtQuick 2.0
import Ossia 1.0 as Ossia
QtObject {
function openListening(address) {}
function closeListening(address) {}
function onMessage(message) {
console.log(message);
return [{address: recieve, value: message}];
}
Thanks @jcelerier ! I updated the code but so far, the values still aren’t updated.
I also added the “access”, “bounding” and “repetition filter” parameters.
“bounding” and “repetition filter” are shown to be updated on the bottom part of the Device explorer but “min”, “max” and “Access” aren’t.
Could the addresses be stuck in “set” mode, although they look to remain in “bi” mode?
import QtQuick 2.0
import Ossia 1.0 as Ossia
QtObject {
function openListening(address) {}
function closeListening(address) {}
function onMessage(message) {
console.log(message);
return [{address: "/receive", value: message}];
}
function createTree() {
return [ {
name: "led",
type: Ossia.Type.Int,
min : 0,
max : 1,
request: "$val",
access: Ossia.Access.Set,
bounding: Ossia.Bounding.Clip,
repetition_filter: Ossia.Repetitions.Filtered
},
{
name: "receive",
type: Ossia.Type.Int,
access: Ossia.Access.Get
} ];
}
}
To match the syntax of messages that score sends out, I made sure the values i receive appear in the message window as “1\n” for exemple.
adding the “\n” I assume finishes the message.
Is the function onMessage(message) bufferized and expecting a certain character of command to consider the end of a message (presumably “\n”)?
Similar to what is done around the 9 min mark in this video:
i’d like to be able to verify this for myself but the “console.log(message)” dosen’t output anything either.