BG96_K6xF_pelion-example-frdm_Temp

Dependencies:   FXAS21002 FXOS8700Q

Overview

This document is based on https://os.mbed.com/teams/NXP/code/pelion-example-frdm/ and the code forked Daniel_Lee's(https://os.mbed.com/users/Daniel_Lee/code/BG96_K6xF_pelion-example-frdm/)BG96_K6xF_pelion-example-frdm repository and added some features. Need a WIZnet IoT Shield BG96 board and development board.

This example is known to work great on the following platforms:

/media/uploads/stkim92/pel01.png

Requirement

  1. FRDM-K64F or FRDM-K66F
  2. WIZnet IoT Shield BG96 board
  3. USIM card

Example functionality

This example showcases the following device functionality:

Read onboard FXOS8700Q accelerometer, magnetometer and temperature(on shield). And report the values as Pelion LWM2M resources (see image below). (FRDM-K66F only) Read onboard FXAS21002 gyroscope and report the values as Pelion LWM2M resources. On user button click, increment Pelion LWM2M button resource. Allow the user to change the state of the board LED from Pelion LWM2M led_state resource and PUT request.

1. Import into Compiler

/media/uploads/stkim92/pel1.png

2. Apply Update Certificate

/media/uploads/stkim92/pel03.png

3. Compile and Program

/media/uploads/stkim92/pel04.png

4. If successfully connect to cellular networks(SKTelecom) then you can get below message

Device's Result

include the mbed library with this snippet

You can hold the user button during boot to format the storage and change the device identity.

M2Mnet(BG96) Power ON



Sensors configuration:

FXOS8700Q accelerometer = 0xC7

FXOS8700Q magnetometer  = 0xC7



Connecting to the network using the default network interface...

Connected to the network successfully. IP address: 2001:2D8:65

Initializing Pelion Device Management Client...

Initialized Pelion Device Management Client. Registering...

Press the user button to increment the LwM2M resource value...

Celsius temp : 26.10 C                                                             

FXOS8700Q mag:    0.217 x,   0.420 y,   0.288 z [gauss]     

Pelion Cloud Result (1)

/media/uploads/stkim92/pel4.png

Pelion Cloud Result (2)

/media/uploads/stkim92/pel5.png

Committer:
stkim92
Date:
Tue Aug 06 14:38:56 2019 +0000
Revision:
14:bd420de18a97
Parent:
0:a9d53048f0b6
Add MbedCloudClientResource_temperature

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:a9d53048f0b6 1 Apache License
screamer 0:a9d53048f0b6 2 Version 2.0, January 2004
screamer 0:a9d53048f0b6 3 http://www.apache.org/licenses/
screamer 0:a9d53048f0b6 4
screamer 0:a9d53048f0b6 5 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
screamer 0:a9d53048f0b6 6
screamer 0:a9d53048f0b6 7 1. Definitions.
screamer 0:a9d53048f0b6 8
screamer 0:a9d53048f0b6 9 "License" shall mean the terms and conditions for use, reproduction, and
screamer 0:a9d53048f0b6 10 distribution as defined by Sections 1 through 9 of this document.
screamer 0:a9d53048f0b6 11
screamer 0:a9d53048f0b6 12 "Licensor" shall mean the copyright owner or entity authorized by the copyright
screamer 0:a9d53048f0b6 13 owner that is granting the License.
screamer 0:a9d53048f0b6 14
screamer 0:a9d53048f0b6 15 "Legal Entity" shall mean the union of the acting entity and all other entities
screamer 0:a9d53048f0b6 16 that control, are controlled by, or are under common control with that entity.
screamer 0:a9d53048f0b6 17 For the purposes of this definition, "control" means (i) the power, direct or
screamer 0:a9d53048f0b6 18 indirect, to cause the direction or management of such entity, whether by
screamer 0:a9d53048f0b6 19 contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
screamer 0:a9d53048f0b6 20 outstanding shares, or (iii) beneficial ownership of such entity.
screamer 0:a9d53048f0b6 21
screamer 0:a9d53048f0b6 22 "You" (or "Your") shall mean an individual or Legal Entity exercising
screamer 0:a9d53048f0b6 23 permissions granted by this License.
screamer 0:a9d53048f0b6 24
screamer 0:a9d53048f0b6 25 "Source" form shall mean the preferred form for making modifications, including
screamer 0:a9d53048f0b6 26 but not limited to software source code, documentation source, and configuration
screamer 0:a9d53048f0b6 27 files.
screamer 0:a9d53048f0b6 28
screamer 0:a9d53048f0b6 29 "Object" form shall mean any form resulting from mechanical transformation or
screamer 0:a9d53048f0b6 30 translation of a Source form, including but not limited to compiled object code,
screamer 0:a9d53048f0b6 31 generated documentation, and conversions to other media types.
screamer 0:a9d53048f0b6 32
screamer 0:a9d53048f0b6 33 "Work" shall mean the work of authorship, whether in Source or Object form, made
screamer 0:a9d53048f0b6 34 available under the License, as indicated by a copyright notice that is included
screamer 0:a9d53048f0b6 35 in or attached to the work (an example is provided in the Appendix below).
screamer 0:a9d53048f0b6 36
screamer 0:a9d53048f0b6 37 "Derivative Works" shall mean any work, whether in Source or Object form, that
screamer 0:a9d53048f0b6 38 is based on (or derived from) the Work and for which the editorial revisions,
screamer 0:a9d53048f0b6 39 annotations, elaborations, or other modifications represent, as a whole, an
screamer 0:a9d53048f0b6 40 original work of authorship. For the purposes of this License, Derivative Works
screamer 0:a9d53048f0b6 41 shall not include works that remain separable from, or merely link (or bind by
screamer 0:a9d53048f0b6 42 name) to the interfaces of, the Work and Derivative Works thereof.
screamer 0:a9d53048f0b6 43
screamer 0:a9d53048f0b6 44 "Contribution" shall mean any work of authorship, including the original version
screamer 0:a9d53048f0b6 45 of the Work and any modifications or additions to that Work or Derivative Works
screamer 0:a9d53048f0b6 46 thereof, that is intentionally submitted to Licensor for inclusion in the Work
screamer 0:a9d53048f0b6 47 by the copyright owner or by an individual or Legal Entity authorized to submit
screamer 0:a9d53048f0b6 48 on behalf of the copyright owner. For the purposes of this definition,
screamer 0:a9d53048f0b6 49 "submitted" means any form of electronic, verbal, or written communication sent
screamer 0:a9d53048f0b6 50 to the Licensor or its representatives, including but not limited to
screamer 0:a9d53048f0b6 51 communication on electronic mailing lists, source code control systems, and
screamer 0:a9d53048f0b6 52 issue tracking systems that are managed by, or on behalf of, the Licensor for
screamer 0:a9d53048f0b6 53 the purpose of discussing and improving the Work, but excluding communication
screamer 0:a9d53048f0b6 54 that is conspicuously marked or otherwise designated in writing by the copyright
screamer 0:a9d53048f0b6 55 owner as "Not a Contribution."
screamer 0:a9d53048f0b6 56
screamer 0:a9d53048f0b6 57 "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
screamer 0:a9d53048f0b6 58 of whom a Contribution has been received by Licensor and subsequently
screamer 0:a9d53048f0b6 59 incorporated within the Work.
screamer 0:a9d53048f0b6 60
screamer 0:a9d53048f0b6 61 2. Grant of Copyright License.
screamer 0:a9d53048f0b6 62
screamer 0:a9d53048f0b6 63 Subject to the terms and conditions of this License, each Contributor hereby
screamer 0:a9d53048f0b6 64 grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
screamer 0:a9d53048f0b6 65 irrevocable copyright license to reproduce, prepare Derivative Works of,
screamer 0:a9d53048f0b6 66 publicly display, publicly perform, sublicense, and distribute the Work and such
screamer 0:a9d53048f0b6 67 Derivative Works in Source or Object form.
screamer 0:a9d53048f0b6 68
screamer 0:a9d53048f0b6 69 3. Grant of Patent License.
screamer 0:a9d53048f0b6 70
screamer 0:a9d53048f0b6 71 Subject to the terms and conditions of this License, each Contributor hereby
screamer 0:a9d53048f0b6 72 grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
screamer 0:a9d53048f0b6 73 irrevocable (except as stated in this section) patent license to make, have
screamer 0:a9d53048f0b6 74 made, use, offer to sell, sell, import, and otherwise transfer the Work, where
screamer 0:a9d53048f0b6 75 such license applies only to those patent claims licensable by such Contributor
screamer 0:a9d53048f0b6 76 that are necessarily infringed by their Contribution(s) alone or by combination
screamer 0:a9d53048f0b6 77 of their Contribution(s) with the Work to which such Contribution(s) was
screamer 0:a9d53048f0b6 78 submitted. If You institute patent litigation against any entity (including a
screamer 0:a9d53048f0b6 79 cross-claim or counterclaim in a lawsuit) alleging that the Work or a
screamer 0:a9d53048f0b6 80 Contribution incorporated within the Work constitutes direct or contributory
screamer 0:a9d53048f0b6 81 patent infringement, then any patent licenses granted to You under this License
screamer 0:a9d53048f0b6 82 for that Work shall terminate as of the date such litigation is filed.
screamer 0:a9d53048f0b6 83
screamer 0:a9d53048f0b6 84 4. Redistribution.
screamer 0:a9d53048f0b6 85
screamer 0:a9d53048f0b6 86 You may reproduce and distribute copies of the Work or Derivative Works thereof
screamer 0:a9d53048f0b6 87 in any medium, with or without modifications, and in Source or Object form,
screamer 0:a9d53048f0b6 88 provided that You meet the following conditions:
screamer 0:a9d53048f0b6 89
screamer 0:a9d53048f0b6 90 You must give any other recipients of the Work or Derivative Works a copy of
screamer 0:a9d53048f0b6 91 this License; and
screamer 0:a9d53048f0b6 92 You must cause any modified files to carry prominent notices stating that You
screamer 0:a9d53048f0b6 93 changed the files; and
screamer 0:a9d53048f0b6 94 You must retain, in the Source form of any Derivative Works that You distribute,
screamer 0:a9d53048f0b6 95 all copyright, patent, trademark, and attribution notices from the Source form
screamer 0:a9d53048f0b6 96 of the Work, excluding those notices that do not pertain to any part of the
screamer 0:a9d53048f0b6 97 Derivative Works; and
screamer 0:a9d53048f0b6 98 If the Work includes a "NOTICE" text file as part of its distribution, then any
screamer 0:a9d53048f0b6 99 Derivative Works that You distribute must include a readable copy of the
screamer 0:a9d53048f0b6 100 attribution notices contained within such NOTICE file, excluding those notices
screamer 0:a9d53048f0b6 101 that do not pertain to any part of the Derivative Works, in at least one of the
screamer 0:a9d53048f0b6 102 following places: within a NOTICE text file distributed as part of the
screamer 0:a9d53048f0b6 103 Derivative Works; within the Source form or documentation, if provided along
screamer 0:a9d53048f0b6 104 with the Derivative Works; or, within a display generated by the Derivative
screamer 0:a9d53048f0b6 105 Works, if and wherever such third-party notices normally appear. The contents of
screamer 0:a9d53048f0b6 106 the NOTICE file are for informational purposes only and do not modify the
screamer 0:a9d53048f0b6 107 License. You may add Your own attribution notices within Derivative Works that
screamer 0:a9d53048f0b6 108 You distribute, alongside or as an addendum to the NOTICE text from the Work,
screamer 0:a9d53048f0b6 109 provided that such additional attribution notices cannot be construed as
screamer 0:a9d53048f0b6 110 modifying the License.
screamer 0:a9d53048f0b6 111 You may add Your own copyright statement to Your modifications and may provide
screamer 0:a9d53048f0b6 112 additional or different license terms and conditions for use, reproduction, or
screamer 0:a9d53048f0b6 113 distribution of Your modifications, or for any such Derivative Works as a whole,
screamer 0:a9d53048f0b6 114 provided Your use, reproduction, and distribution of the Work otherwise complies
screamer 0:a9d53048f0b6 115 with the conditions stated in this License.
screamer 0:a9d53048f0b6 116
screamer 0:a9d53048f0b6 117 5. Submission of Contributions.
screamer 0:a9d53048f0b6 118
screamer 0:a9d53048f0b6 119 Unless You explicitly state otherwise, any Contribution intentionally submitted
screamer 0:a9d53048f0b6 120 for inclusion in the Work by You to the Licensor shall be under the terms and
screamer 0:a9d53048f0b6 121 conditions of this License, without any additional terms or conditions.
screamer 0:a9d53048f0b6 122 Notwithstanding the above, nothing herein shall supersede or modify the terms of
screamer 0:a9d53048f0b6 123 any separate license agreement you may have executed with Licensor regarding
screamer 0:a9d53048f0b6 124 such Contributions.
screamer 0:a9d53048f0b6 125
screamer 0:a9d53048f0b6 126 6. Trademarks.
screamer 0:a9d53048f0b6 127
screamer 0:a9d53048f0b6 128 This License does not grant permission to use the trade names, trademarks,
screamer 0:a9d53048f0b6 129 service marks, or product names of the Licensor, except as required for
screamer 0:a9d53048f0b6 130 reasonable and customary use in describing the origin of the Work and
screamer 0:a9d53048f0b6 131 reproducing the content of the NOTICE file.
screamer 0:a9d53048f0b6 132
screamer 0:a9d53048f0b6 133 7. Disclaimer of Warranty.
screamer 0:a9d53048f0b6 134
screamer 0:a9d53048f0b6 135 Unless required by applicable law or agreed to in writing, Licensor provides the
screamer 0:a9d53048f0b6 136 Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
screamer 0:a9d53048f0b6 137 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
screamer 0:a9d53048f0b6 138 including, without limitation, any warranties or conditions of TITLE,
screamer 0:a9d53048f0b6 139 NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
screamer 0:a9d53048f0b6 140 solely responsible for determining the appropriateness of using or
screamer 0:a9d53048f0b6 141 redistributing the Work and assume any risks associated with Your exercise of
screamer 0:a9d53048f0b6 142 permissions under this License.
screamer 0:a9d53048f0b6 143
screamer 0:a9d53048f0b6 144 8. Limitation of Liability.
screamer 0:a9d53048f0b6 145
screamer 0:a9d53048f0b6 146 In no event and under no legal theory, whether in tort (including negligence),
screamer 0:a9d53048f0b6 147 contract, or otherwise, unless required by applicable law (such as deliberate
screamer 0:a9d53048f0b6 148 and grossly negligent acts) or agreed to in writing, shall any Contributor be
screamer 0:a9d53048f0b6 149 liable to You for damages, including any direct, indirect, special, incidental,
screamer 0:a9d53048f0b6 150 or consequential damages of any character arising as a result of this License or
screamer 0:a9d53048f0b6 151 out of the use or inability to use the Work (including but not limited to
screamer 0:a9d53048f0b6 152 damages for loss of goodwill, work stoppage, computer failure or malfunction, or
screamer 0:a9d53048f0b6 153 any and all other commercial damages or losses), even if such Contributor has
screamer 0:a9d53048f0b6 154 been advised of the possibility of such damages.
screamer 0:a9d53048f0b6 155
screamer 0:a9d53048f0b6 156 9. Accepting Warranty or Additional Liability.
screamer 0:a9d53048f0b6 157
screamer 0:a9d53048f0b6 158 While redistributing the Work or Derivative Works thereof, You may choose to
screamer 0:a9d53048f0b6 159 offer, and charge a fee for, acceptance of support, warranty, indemnity, or
screamer 0:a9d53048f0b6 160 other liability obligations and/or rights consistent with this License. However,
screamer 0:a9d53048f0b6 161 in accepting such obligations, You may act only on Your own behalf and on Your
screamer 0:a9d53048f0b6 162 sole responsibility, not on behalf of any other Contributor, and only if You
screamer 0:a9d53048f0b6 163 agree to indemnify, defend, and hold each Contributor harmless for any liability
screamer 0:a9d53048f0b6 164 incurred by, or claims asserted against, such Contributor by reason of your
screamer 0:a9d53048f0b6 165 accepting any such warranty or additional liability.