Read the statement by Michael Teeuw here.
MMM-GroveGestures
-
@Benjaminh86
Let’s assume You have page1
and2
.You can assign gesture
LEFT
to1
,RIGHT
to2
.
At that case, you can add this to your command set(default or any other you want)."LEFT": { notificationExec: { notification: "PAGE_SELECT", payload: "1", } }, "RIGHT": { notificationExec: { notification: "PAGE_SELECT", payload: "2", } },
The problem is,
MMM-page-selector
has no feature of “NEXT PAGE” or “PREVIOUS PAGE”. so when there be more than 2 pages, you should assign gestures per each page. -
@Sean as I said, I’m a beginner, and I do not understand everything in programming.
In addition, I have a synthaxe error on the line “exec: (module, gestures) => {”
it indicates a problem with the symbol =>.
Can you help me? -
@Benjaminh86
Show me your configuration. -
@Sean
here is my configuration for your module :
{
module: “MMM-GroveGestures”,
position: “top_right”,
pages: {‘all’: ‘top_right’},
config: {
autoStart: true, //When Mirror starts, recognition will start.
verbose:false, // If set astrue
, useful messages will be logged.
recognitionTimeout: 1000, //Gesture sequence will be ended after this time from last recognized gesture.
cancelGesture: “WAVE”, //If set, You can cancel gesture sequence with this gesture.
visible: true, //Recognized gesture sequence will be displayed on positionidleTimer: 1000*60*30, // `0` for disable, After this time from last gesture, onIdle will be executed. onIdle: { // See command section moduleExec: { module: [], exec: (module, gestures) => { module.hide(1000, null, {lockstring:"GESTURE"}) } } }, onDetected: { notificationExec: { notification: "GESTURE_DETECTED", }, /* You can make Mirror to wake up the modules which were hidden by onIdle with any gestures. moduleExec: { module: [], exec: (module) => { module.show(1000, null, {lockstring:"GESTURE"}) } } */ }, gestureMapFromTo: { //When your sensor is installed with rotated direction, you can calibrate with this. "Up": "UP", "Down": "DOWN", "Left": "LEFT", "Right": "RIGHT", "Forward": "FORWARD", "Backward": "BACKWARD", "Clockwise": "CLOCKWISE", "anti-clockwise": "ANTICLOCKWISE", "wave": "WAVE" }, commandSet: { "LEFT": { notificationExec: { notification: "PAGE_SELECT", payload: "main", } }, "RIGHT": { notificationExec: { notification: "PAGE_SELECT", payload: "2", } }, }, },
}
}, -
@Benjaminh86
Your configuration about commandSet has something wrong.commandSet: { "default" : { "LEFT": { notificationExec: { notification: "PAGE_SELECT", payload: "main", } }, "RIGHT": { notificationExec: { notification: "PAGE_SELECT", payload: "2", } }, }, },
-
@Benjaminh86
And Have you syntax error? How did you know? Have you usednpm check:config
? That knows old-fashioned style javascript grammar. So it might not understand new trendy ES6 style grammar.
Try this to check your javascript syntax.
http://esprima.org/demo/validate.html -
@Sean
I used the command “npm run config: check”
-
@Sean I modified my JavaScript and corrected the errors.
On my Magic Mirror, I can see my left right scan, but the page does not change.
an idea… -
@Benjaminh86
Well, If notification would be emitted properly, remains are MMM-page-selector’s business.
You can check whether notification is broadcasted well withnpm start dev
(before it, stop yourpm2
) orCtrl+Shift+i
on MM running. You can get some useful messages on dev-console -
Hello @Sean
i will watch npm start dev.
Thanks for your help.BenH