revision of example 'tilt-sensor'

This commit is contained in:
pls.153 2022-04-15 16:22:58 +02:00
parent d8e26b05cf
commit 1444d1639b
2 changed files with 5 additions and 4 deletions

View file

@ -13,8 +13,10 @@
+w+))) +w+)))
(normalize (x) (normalize (x)
(* (to-pos x) +w+))) (* (to-pos x) +w+)))
(let* ((dx (min (* 0.2 x-rotation) (1- +w+))) ;; x axis rotation changes y
(dy (min (* 0.2 y-rotation) (1- +w+))) ;; y axis rotation changes x
(let* ((dx (min (* 0.2 y-rotation) (1- +w+)))
(dy (min (* 0.2 x-rotation) (1- +w+)))
(add-x (add dx)) (add-x (add dx))
(add-y (add dy))) (add-y (add dy)))
(if (aref *maze* (if (aref *maze*

View file

@ -68,7 +68,6 @@ Rectangle {
interval: 30 interval: 30
repeat: true repeat: true
// reversed: x axis changes y position, y axis changes x position onTriggered: Lisp.call("maze:move", tilt.reading.xRotation, tilt.reading.yRotation)
onTriggered: Lisp.call("maze:move", tilt.reading.yRotation, tilt.reading.xRotation)
} }
} }