An e-compass solution requires knowwlede two pieces of data to provide an accurate heading: - Accurate calibration of the magnetometer hardware so that reliable measurements can be taken. - Knowledge of the pitch and roll of of device, so that the correct components of the X/Y and Z axis sensors of the magnetomer can be used to sense the magnetic field in a horizontal plane regardless of the tilt of the device. This commit represent changes to the MicroBitAccelerometer and MicroBitCompass classes to implemen tthese goals. More specifically, this commit provides: - The introduciton of an interactive calibration 'game', that can rapidly gather all the data required to calibrate the compass. - An improved calibration algorithm based on a Least Mean Squares approach of compass samples, as documened in Freescale Application Note AN4248. - The inclusion of a simple Matrix4 class to enable efficient Least Mean Squares implementation. - A change from asynchronous to synchronous calibration of the compass when first used. This is in repsonse to a feature request for this from users and high level languages using microbit-dal. - Support for detemrining tilt and roll angle in MicroBitAccelerometer - Support for multiple co-ordinate spaces in MicroBitAccelerometer and MicroBitCompass. Data can now be read in either RAW (unaltered) data. MICORBIT_SIMPLE_CARTESIAN (as used previously) or NORTH_EAST_DOWN (the industry convention in mobile phones, tablets and aviation) - Implementation of a tilt compensated algorithm, used when determining device heading.
|7 years ago|
|docs||7 years ago|
|inc||7 years ago|
|source||7 years ago|
|.gitignore||7 years ago|
|CHANGES.md||8 years ago|
|README.md||8 years ago|
|module.json||7 years ago|
Building a project for the micro:bit using Yotta
Instead of using the online IDE, Yotta can be used to provide an equivalent offline experience. The current compilers that are available are:
1. Install Yotta
The first step is to get Yotta onto your machine, to do this follow the install guide here
Note: if you are on windows, dependencies will be missed as of 8/8/15, please use the helper script located here.
2. Fetch the example project
If your install has gone correctly, and you have all dependencies installed, the next step is to fetch the example project using the runtime from GitHub.
git clone https://github.com/lancaster-university/microbit
Note: To successfully build this project you will need access to the microbit-dal private repository, if you need access please email me at firstname.lastname@example.org.
3. Try to build
Building rarely works first time due to dependencies currently not being installed by Yotta, so the next step is to try to build.
The default yotta target you will receive when you pull the aforementioned repo is bbc-microbit-classic-armcc, you can use the following command to print your current target in Yotta:
yt target bbc-microbit-classic-armcc 0.0.5 mbed-armcc 0.0.8
If you do not have armcc installed (or don't have a license for Keil), then you will need to use GCC. To swap to the GCC target run:
yt target bbc-microbit-classic-gcc
Then you should try to build using the following command:
To build the final hex files for the micro:bit, you will need to install the srec which can be installed via brew (
brew install srecord), or you can install it manually from here.
4. Flash your micro:bit
The final step is to check your hex works.
The yotta build command will place files in
/build/<TARGET_NAME>/source. The file you will need to flash will be microbit-combined.hex. Simply drag and drop the hex.
The expected result will be that the micro:bit will scroll
BELLO! :) on its display.