diff --git a/exercises/robot_arm/problem.fr.md b/exercises/robot_arm/problem.fr.md index 18f7308..f47f07c 100644 --- a/exercises/robot_arm/problem.fr.md +++ b/exercises/robot_arm/problem.fr.md @@ -39,13 +39,11 @@ Utilise un potentiomètre (potard) pour controller la position d'un servomoteur. ## Documentation - Sensor - https://github.com/rwaldron/johnny-five/wiki/Sensor -- Fn - https://github.com/rwaldron/johnny-five/blob/master/lib/fn.js ## Conseils - Un potard est un autre cas d'utilisation de l'objet 'Sensor'... - Un potard a produit des valeurs dans une plage allant de 0 a 1023. - Un servomoteur peut généralement étre orienté dans un angle de 0 a 180°. -- `five.Fn.map` peut étre utiliser pour normaliser les valeur du potard (0 - 1023) en angles pour le servomoteur (0 - 179). -* * * \ No newline at end of file +* * * diff --git a/exercises/robot_arm/problem.ja.md b/exercises/robot_arm/problem.ja.md index 63f0089..51e2ee6 100644 --- a/exercises/robot_arm/problem.ja.md +++ b/exercises/robot_arm/problem.ja.md @@ -40,13 +40,11 @@ GND o---.------/\/\/------. ## ドキュメント - Sensor - https://github.com/rwaldron/johnny-five/wiki/Sensor -- Fn - https://github.com/rwaldron/johnny-five/blob/master/lib/fn.js ## ヒント - ポテンショメータは、センサーオブジェクトの別のユースケースです。 - 0〜1023の間の入力値を生成します。 - サーボは通常0〜179度の角度を動くことができます。 -- `five.Fn.mapメソッド`はポテンショメータの値(0~1023)をサーボの角度(0~179)にマッピングすることができます。 --- diff --git a/exercises/robot_arm/problem.md b/exercises/robot_arm/problem.md index 126af03..eccca42 100644 --- a/exercises/robot_arm/problem.md +++ b/exercises/robot_arm/problem.md @@ -40,13 +40,11 @@ GND o---.------/\/\/------. ## Docs - Sensor - https://github.com/rwaldron/johnny-five/wiki/Sensor -- Fn - https://github.com/rwaldron/johnny-five/blob/master/lib/fn.js ## Hints - A potentiometer is another use case for the Sensor object... - A pot produces input values between 0 and 1023. - A servo can typically be moved between 0 and 179 degrees. -- `five.Fn.map` can map the pot values (0 - 1023) to servo angles (0 - 179). --- diff --git a/exercises/robot_arm/solution/solution.js b/exercises/robot_arm/solution/solution.js index 4daa62d..ec5c125 100644 --- a/exercises/robot_arm/solution/solution.js +++ b/exercises/robot_arm/solution/solution.js @@ -5,21 +5,7 @@ board.on('ready', function () { var servo = new five.Servo(9) var pot = new five.Sensor('A2') - pot.on('change', function () { - var position = five.Fn.map(this.value, - 0, 1023, - 0, 179 - ) - - servo.to(position) - }) - - // Alternatively, sensor provides a `scale` method as an alias to Fn.map - /* - pot.scale(0, 179).on('change', function () { - - // `this.value` will reflect a scaling from 0-1023 to 0-179 + pot.scaleTo(0,179).on('change', function () { servo.to(this.value) }) - */ })