Joystick Controlled Servos

Dependencies:   Servo Map

Committer:
Galib_Rahman
Date:
Wed Dec 12 17:31:29 2018 +0000
Revision:
0:7e748374bdff
Simran's Joystick Controlled Servos

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Galib_Rahman 0:7e748374bdff 1 # Getting started example for Mbed OS
Galib_Rahman 0:7e748374bdff 2
Galib_Rahman 0:7e748374bdff 3 This guide reviews the steps required to get Blinky with the addition of dynamic OS statistics working on an Mbed OS platform.
Galib_Rahman 0:7e748374bdff 4
Galib_Rahman 0:7e748374bdff 5 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
Galib_Rahman 0:7e748374bdff 6
Galib_Rahman 0:7e748374bdff 7 ## Import the example application
Galib_Rahman 0:7e748374bdff 8
Galib_Rahman 0:7e748374bdff 9 From the command-line, import the example:
Galib_Rahman 0:7e748374bdff 10
Galib_Rahman 0:7e748374bdff 11 ```
Galib_Rahman 0:7e748374bdff 12 mbed import mbed-os-example-blinky
Galib_Rahman 0:7e748374bdff 13 cd mbed-os-example-blinky
Galib_Rahman 0:7e748374bdff 14 ```
Galib_Rahman 0:7e748374bdff 15
Galib_Rahman 0:7e748374bdff 16 ### Now compile
Galib_Rahman 0:7e748374bdff 17
Galib_Rahman 0:7e748374bdff 18 Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
Galib_Rahman 0:7e748374bdff 19
Galib_Rahman 0:7e748374bdff 20 ```
Galib_Rahman 0:7e748374bdff 21 mbed compile -m K64F -t ARM
Galib_Rahman 0:7e748374bdff 22 ```
Galib_Rahman 0:7e748374bdff 23
Galib_Rahman 0:7e748374bdff 24 Your PC may take a few minutes to compile your code. At the end, you see the following result:
Galib_Rahman 0:7e748374bdff 25
Galib_Rahman 0:7e748374bdff 26 ```
Galib_Rahman 0:7e748374bdff 27 [snip]
Galib_Rahman 0:7e748374bdff 28 +----------------------------+-------+-------+------+
Galib_Rahman 0:7e748374bdff 29 | Module | .text | .data | .bss |
Galib_Rahman 0:7e748374bdff 30 |--------------------|-----------|----------|----------|
Galib_Rahman 0:7e748374bdff 31 | [fill] | 98(+0) | 0(+0) | 2211(+0) |
Galib_Rahman 0:7e748374bdff 32 | [lib]/c.a | 27835(+0) | 2472(+0) | 89(+0) |
Galib_Rahman 0:7e748374bdff 33 | [lib]/gcc.a | 3168(+0) | 0(+0) | 0(+0) |
Galib_Rahman 0:7e748374bdff 34 | [lib]/misc | 248(+0) | 8(+0) | 28(+0) |
Galib_Rahman 0:7e748374bdff 35 | [lib]/nosys.a | 32(+0) | 0(+0) | 0(+0) |
Galib_Rahman 0:7e748374bdff 36 | main.o | 924(+0) | 0(+0) | 12(+0) |
Galib_Rahman 0:7e748374bdff 37 | mbed-os/components | 134(+0) | 0(+0) | 0(+0) |
Galib_Rahman 0:7e748374bdff 38 | mbed-os/drivers | 56(+0) | 0(+0) | 0(+0) |
Galib_Rahman 0:7e748374bdff 39 | mbed-os/features | 42(+0) | 0(+0) | 184(+0) |
Galib_Rahman 0:7e748374bdff 40 | mbed-os/hal | 2087(+0) | 8(+0) | 152(+0) |
Galib_Rahman 0:7e748374bdff 41 | mbed-os/platform | 3633(+0) | 260(+0) | 209(+0) |
Galib_Rahman 0:7e748374bdff 42 | mbed-os/rtos | 9370(+0) | 168(+0) | 6053(+0) |
Galib_Rahman 0:7e748374bdff 43 | mbed-os/targets | 9536(+0) | 12(+0) | 382(+0) |
Galib_Rahman 0:7e748374bdff 44 | Subtotals | 57163(+0) | 2928(+0) | 9320(+0) |
Galib_Rahman 0:7e748374bdff 45 Total Static RAM memory (data + bss): 12248(+0) bytes
Galib_Rahman 0:7e748374bdff 46 Total Flash memory (text + data): 60091(+0) bytes
Galib_Rahman 0:7e748374bdff 47
Galib_Rahman 0:7e748374bdff 48 Image: ./BUILD/K64F/GCC_ARM/mbed-os-example-blinky.bin
Galib_Rahman 0:7e748374bdff 49 ```
Galib_Rahman 0:7e748374bdff 50
Galib_Rahman 0:7e748374bdff 51 ### Program your board
Galib_Rahman 0:7e748374bdff 52
Galib_Rahman 0:7e748374bdff 53 1. Connect your mbed device to the computer over USB.
Galib_Rahman 0:7e748374bdff 54 1. Copy the binary file to the mbed device.
Galib_Rahman 0:7e748374bdff 55 1. Press the reset button to start the program.
Galib_Rahman 0:7e748374bdff 56
Galib_Rahman 0:7e748374bdff 57 The LED on your platform turns on and off. The main thread will additionally take a snapshot of the device's runtime statistics and display it over serial to your PC. The snapshot includes:
Galib_Rahman 0:7e748374bdff 58
Galib_Rahman 0:7e748374bdff 59 * System Information:
Galib_Rahman 0:7e748374bdff 60 * Mbed OS Version: Will currently default to 999999
Galib_Rahman 0:7e748374bdff 61 * Compiler ID
Galib_Rahman 0:7e748374bdff 62 * ARM = 1
Galib_Rahman 0:7e748374bdff 63 * GCC_ARM = 2
Galib_Rahman 0:7e748374bdff 64 * IAR = 3
Galib_Rahman 0:7e748374bdff 65 * [CPUID Register Information](#cpuid-register-information)
Galib_Rahman 0:7e748374bdff 66 * [Compiler Version](#compiler-version)
Galib_Rahman 0:7e748374bdff 67 * CPU Statistics
Galib_Rahman 0:7e748374bdff 68 * Percentage of runtime that the device has spent awake versus in sleep
Galib_Rahman 0:7e748374bdff 69 * Heap Statistics
Galib_Rahman 0:7e748374bdff 70 * Current heap size
Galib_Rahman 0:7e748374bdff 71 * Max heap size which refers to the largest the heap has grown to
Galib_Rahman 0:7e748374bdff 72 * Thread Statistics
Galib_Rahman 0:7e748374bdff 73 * Provides information on all running threads in the OS including
Galib_Rahman 0:7e748374bdff 74 * Thread ID
Galib_Rahman 0:7e748374bdff 75 * Thread Name
Galib_Rahman 0:7e748374bdff 76 * Thread State
Galib_Rahman 0:7e748374bdff 77 * Thread Priority
Galib_Rahman 0:7e748374bdff 78 * Thread Stack Size
Galib_Rahman 0:7e748374bdff 79 * Thread Stack Space
Galib_Rahman 0:7e748374bdff 80
Galib_Rahman 0:7e748374bdff 81 #### Compiler Version
Galib_Rahman 0:7e748374bdff 82
Galib_Rahman 0:7e748374bdff 83 | Compiler | Version Layout |
Galib_Rahman 0:7e748374bdff 84 | -------- | -------------- |
Galib_Rahman 0:7e748374bdff 85 | ARM | PVVbbbb (P = Major; VV = Minor; bbbb = build number) |
Galib_Rahman 0:7e748374bdff 86 | GCC | VVRRPP (VV = Version; RR = Revision; PP = Patch) |
Galib_Rahman 0:7e748374bdff 87 | IAR | VRRRPPP (V = Version; RRR = Revision; PPP = Patch) |
Galib_Rahman 0:7e748374bdff 88
Galib_Rahman 0:7e748374bdff 89 #### CPUID Register Information
Galib_Rahman 0:7e748374bdff 90
Galib_Rahman 0:7e748374bdff 91 | Bit Field | Field Description | Values |
Galib_Rahman 0:7e748374bdff 92 | --------- | ----------------- | ------ |
Galib_Rahman 0:7e748374bdff 93 |[31:24] | Implementer | 0x41 = ARM |
Galib_Rahman 0:7e748374bdff 94 |[23:20] | Variant | Major revision 0x0 = Revision 0 |
Galib_Rahman 0:7e748374bdff 95 |[19:16] | Architecture | 0xC = Baseline Architecture |
Galib_Rahman 0:7e748374bdff 96 | | | 0xF = Constant (Mainline Architecture) |
Galib_Rahman 0:7e748374bdff 97 |[15:4] | Part Number | 0xC20 = Cortex-M0 |
Galib_Rahman 0:7e748374bdff 98 | | | 0xC60 = Cortex-M0+ |
Galib_Rahman 0:7e748374bdff 99 | | | 0xC23 = Cortex-M3 |
Galib_Rahman 0:7e748374bdff 100 | | | 0xC24 = Cortex-M4 |
Galib_Rahman 0:7e748374bdff 101 | | | 0xC27 = Cortex-M7 |
Galib_Rahman 0:7e748374bdff 102 | | | 0xD20 = Cortex-M23 |
Galib_Rahman 0:7e748374bdff 103 | | | 0xD21 = Cortex-M33 |
Galib_Rahman 0:7e748374bdff 104 |[3:0] | Revision | Minor revision: 0x1 = Patch 1 |
Galib_Rahman 0:7e748374bdff 105
Galib_Rahman 0:7e748374bdff 106
Galib_Rahman 0:7e748374bdff 107
Galib_Rahman 0:7e748374bdff 108 You can view individual examples and additional API information of the statistics collection tools at the bottom of the page in the [related links section](#related-links).
Galib_Rahman 0:7e748374bdff 109
Galib_Rahman 0:7e748374bdff 110
Galib_Rahman 0:7e748374bdff 111 ### Output
Galib_Rahman 0:7e748374bdff 112
Galib_Rahman 0:7e748374bdff 113 To view the serial output you can use any terminal client of your choosing such as [PuTTY](http://www.putty.org/) or [CoolTerm](http://freeware.the-meiers.org/).
Galib_Rahman 0:7e748374bdff 114
Galib_Rahman 0:7e748374bdff 115 The default baud rate for this application is set to `115200` and may be modified in the `mbed_app.json` file.
Galib_Rahman 0:7e748374bdff 116
Galib_Rahman 0:7e748374bdff 117 You can find more information on the Mbed OS configuration tools and serail communication in Mbed OS in the related [related links section](#related-links).
Galib_Rahman 0:7e748374bdff 118
Galib_Rahman 0:7e748374bdff 119 The output should contain the following block transmitted at the blinking LED frequency (actual values may vary depending on your target, build profile, and toolchain):
Galib_Rahman 0:7e748374bdff 120
Galib_Rahman 0:7e748374bdff 121 ```
Galib_Rahman 0:7e748374bdff 122 =============================== SYSTEM INFO ================================
Galib_Rahman 0:7e748374bdff 123 Mbed OS Version: 999999
Galib_Rahman 0:7e748374bdff 124 CPU ID: 0x410fc241
Galib_Rahman 0:7e748374bdff 125 Compiler ID: 2
Galib_Rahman 0:7e748374bdff 126 Compiler Version: 60300
Galib_Rahman 0:7e748374bdff 127 ================= CPU STATS =================
Galib_Rahman 0:7e748374bdff 128 Idle: 98% Usage: 2%
Galib_Rahman 0:7e748374bdff 129 ================ HEAP STATS =================
Galib_Rahman 0:7e748374bdff 130 Current heap: 1096
Galib_Rahman 0:7e748374bdff 131 Max heap size: 1096
Galib_Rahman 0:7e748374bdff 132 ================ THREAD STATS ===============
Galib_Rahman 0:7e748374bdff 133 ID: 0x20001eac
Galib_Rahman 0:7e748374bdff 134 Name: main_thread
Galib_Rahman 0:7e748374bdff 135 State: 2
Galib_Rahman 0:7e748374bdff 136 Priority: 24
Galib_Rahman 0:7e748374bdff 137 Stack Size: 4096
Galib_Rahman 0:7e748374bdff 138 Stack Space: 3296
Galib_Rahman 0:7e748374bdff 139
Galib_Rahman 0:7e748374bdff 140 ID: 0x20000f5c
Galib_Rahman 0:7e748374bdff 141 Name: idle_thread
Galib_Rahman 0:7e748374bdff 142 State: 1
Galib_Rahman 0:7e748374bdff 143 Priority: 1
Galib_Rahman 0:7e748374bdff 144 Stack Size: 512
Galib_Rahman 0:7e748374bdff 145 Stack Space: 352
Galib_Rahman 0:7e748374bdff 146
Galib_Rahman 0:7e748374bdff 147 ID: 0x20000f18
Galib_Rahman 0:7e748374bdff 148 Name: timer_thread
Galib_Rahman 0:7e748374bdff 149 State: 3
Galib_Rahman 0:7e748374bdff 150 Priority: 40
Galib_Rahman 0:7e748374bdff 151 Stack Size: 768
Galib_Rahman 0:7e748374bdff 152 Stack Space: 664
Galib_Rahman 0:7e748374bdff 153
Galib_Rahman 0:7e748374bdff 154 ```
Galib_Rahman 0:7e748374bdff 155
Galib_Rahman 0:7e748374bdff 156 ## Troubleshooting
Galib_Rahman 0:7e748374bdff 157
Galib_Rahman 0:7e748374bdff 158 If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
Galib_Rahman 0:7e748374bdff 159
Galib_Rahman 0:7e748374bdff 160 ## Related Links
Galib_Rahman 0:7e748374bdff 161
Galib_Rahman 0:7e748374bdff 162 * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html)
Galib_Rahman 0:7e748374bdff 163 * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html)
Galib_Rahman 0:7e748374bdff 164 * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html)