You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 24, 2019. It is now read-only.
Modify the main.cpp to understand the new "abstract" buttons in mbed OS.
Prevoius buttons were applicable only to K64F, but since mbed OS has
BUTTON1 and BUTTON2, you can check for those in a board independent manner.
Add instructions how to figure out which button is which one.
<span class="notes">**Note:** Device name is the endpoint name you will need later on when [testing the application](https://github.com/ARMmbed/mbed-os-example-client#testing-the-application).</span>
369
369
370
-
When you press the **SW2** button on your board you should see messages about the value changes:
370
+
When you press the **BUTTON1** button on your board you should see messages about the value changes:
371
371
372
372
```
373
373
handle_button_click, new value of counter is 1
374
374
```
375
+
## Which button is BUTTON1 or BUTTON2?
375
376
377
+
The abstract button definitions are not printed on the boards. The easiest way to find out which button is which is to grep the code. Example below finds the `BUTTON1` for K64F.
I.e. we can deduce that BUTTON1 is the button labeled SW2 in the actual physical board.
386
+
387
+
376
388
## Testing the application
377
389
378
390
1. Flash the application.
379
391
2. Verify that the registration succeeded. You should see `Registered object successfully!` printed to the serial port.
380
392
3. On mbed Device Connector, go to [My devices > Connected devices](https://connector.mbed.com/#endpoints). Your device should be listed here.
381
-
4. Press the **SW2** button on the device a number of times (make a note of how many times you did that).
393
+
4. Press the **BUTTON1** button on the device a number of times (make a note of how many times you did that).
382
394
5. Go to [Device Connector > API Console](https://connector.mbed.com/#console).
383
395
6. Click the **Endpoint directory lookups** drop down menu.
384
396

385
397
7. In the menu, click **GET** next to **Endpoint's resource representation**. Select your _endpoint_ and _resource-path_. For example, the _endpoint_ is the identifier of your endpoint that can be found in the `security.h` file as `MBED_ENDPOINT_NAME`. Select `3200/0/5501`as a resource path and click **TEST API**.
386
-
8. The number of times you pressed **SW2** is shown.
387
-
9. Press the **SW3** button to unregister from mbed Device Connector. You should see `Unregistered Object Successfully` printed to the serial port and the LED starts blinking. This will also stop your application. Press the **Reset** button to run the program again.
398
+
8. The number of times you pressed **BUTTON1** is shown.
399
+
9. Press the **BUTTON2** button to unregister from mbed Device Connector. You should see `Unregistered Object Successfully` printed to the serial port and the LED starts blinking. This will also stop your application. Press the **Reset** button to run the program again.
388
400
389
-
<span class="notes">**Note:** On non-K64F boards, there is no unregistration functionality and button presses are simulated through timer ticks incrementing every 15 seconds.</span>
401
+
<spanclass="notes">**Note:** On boards without BUTTON2 there is no unregistration functionality. Boards without buttons the button presses are simulated through timer ticks incrementing every 15 seconds. Please note the actual printout on the board for the BUTTON1 and BUTTON2 changes a lot - you need map that out from the mbed OS board files.</span>
390
402
391
-

403
+

392
404
393
405
<spanclass="tips">**Tip:** If you get an error, for example `Server Response: 410 (Gone)`, clear your browser's cache, log out, and log back in.</span>
394
406
@@ -398,14 +410,18 @@ handle_button_click, new value of counter is 1
398
410
399
411
The application exposes three [resources](https://docs.mbed.com/docs/mbed-device-connector-web-interfaces/en/latest/#the-mbed-device-connector-data-model):
400
412
401
-
1. `3200/0/5501`. Number of presses of **SW2** (GET).
413
+
1.`3200/0/5501`. Number of presses of **BUTTON1** (GET).
402
414
2.`3201/0/5850`. Blink function, blinks **LED1** when executed (POST).
403
415
3.`3201/0/5853`. Blink pattern, used by the blink function to determine how to blink. In the format of `1000:500:1000:500:1000:500` (PUT).
404
416
405
417
To learn how to get notifications when resource 1 changes, or how to use resources 2 and 3, read the [mbed Device Connector Quick Start](https://github.com/ARMmbed/mbed-connector-api-node-quickstart).
406
418
407
419
## Known issues
408
420
421
+
### mbed OS 5.5
422
+
423
+
*[UBLOX_EVK_ODIN_W2]: BUTTON1 and BUTTON2 definitions are missing from board file.
424
+
409
425
### mbed OS 5.4
410
426
411
427
*[UBLOX_EVK_ODIN_W2]: This example is not compiling with IAR. See [#194](https://github.com/ARMmbed/mbed-os-example-client/issues/194)
0 commit comments