Merge pull request #568 from Microsoft/watch-project-fixes
Some bugs in the 'watch' project
This commit is contained in:
commit
552e05cf0a
@ -189,7 +189,7 @@ Now, we have to join up the hours and minutes to make text that will display on
|
|||||||
2. Make 3 copies of this last ``||variables:set to||`` using the **Duplicate** option in the menu when you right click on the block. Put the copies underneath each other so that all 4 are stacked together.
|
2. Make 3 copies of this last ``||variables:set to||`` using the **Duplicate** option in the menu when you right click on the block. Put the copies underneath each other so that all 4 are stacked together.
|
||||||
3. In the first ``||variables:set to||``, replace the second `""` in the ``||text:join||`` with the `adjust` variable.
|
3. In the first ``||variables:set to||``, replace the second `""` in the ``||text:join||`` with the `adjust` variable.
|
||||||
4. With the second copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to `":"`.
|
4. With the second copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to `":"`.
|
||||||
5. In the fourth copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to division operator from **Math**. Set the left `0` to the `minutes` variable and the right `0` to `10`.
|
5. In the third copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to division operator from **Math**. Set the left `0` to the `minutes` variable and the right `0` to `10`.
|
||||||
6. In the fourth copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to a ``||Math:remainder of||`` in **Math**. Set the left `0` to the `minutes` variable and the right `0` to `10`.
|
6. In the fourth copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to a ``||Math:remainder of||`` in **Math**. Set the left `0` to the `minutes` variable and the right `0` to `10`.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
@ -30,14 +30,14 @@ We'll use button `A` to add `10` seconds to our time count. The time count of `s
|
|||||||
2. Get an ``||logic:if then||`` block from **Logic** and put it in the ``||input:on button pressed||``.
|
2. Get an ``||logic:if then||`` block from **Logic** and put it in the ``||input:on button pressed||``.
|
||||||
3. From the same **Logic** category, get a ``||logic:0 < 0||`` and relpace the `false` condition with it.
|
3. From the same **Logic** category, get a ``||logic:0 < 0||`` and relpace the `false` condition with it.
|
||||||
4. Change the left `0` in the condtion to the `seconds` variable. Change `0` on the right to `50`. This limits time to just one minute.
|
4. Change the left `0` in the condtion to the `seconds` variable. Change `0` on the right to `50`. This limits time to just one minute.
|
||||||
5. In the ``||logic:then||`` section, put a ``||variables:change by||`` there. Select the `seconds` variable name from the dropdown and change the `0` on the right to `10'.
|
5. In the ``||logic:then||`` section, put a ``||variables:change by||`` there. Select the `seconds` variable name from the dropdown and change the `0` on the right to `10`.
|
||||||
6. Add a ``||basic:show number||`` below the ``||variables:change by||``. Change the value to the `seconds` variable. Then, put a ``||basic:clear screen||`` under that.
|
6. Add a ``||basic:show number||`` below the ``||variables:change by||``. Change the value to the `seconds` variable. Then, put a ``||basic:clear screen||`` under that.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let seconds = 0;
|
let seconds = 0;
|
||||||
input.onButtonPressed(Button.A, () => {
|
input.onButtonPressed(Button.A, () => {
|
||||||
if (seconds < 50) {
|
if (seconds < 50) {
|
||||||
seconds += 1;
|
seconds += 10;
|
||||||
basic.showNumber(seconds)
|
basic.showNumber(seconds)
|
||||||
basic.clearScreen()
|
basic.clearScreen()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user