Using the Accelerometer on the FRDM-KL25 Board in KDS

File uploaded by Ben Trevett Employee on Jun 26, 2014Last modified by Diana Torres on Feb 28, 2017
Version 5Show Document
  • View in full screen mode

Accelerometer in KDS




This is a small project made in KDS using the accelerometer on a FRDM-KL25Z128M4 board.

The program outputs the 3D position of the board to a terminal, such as Tera Term at 9600 baud.

PWMs are also used, their intensity is dependent on the offset from the zero position.

The red LED intensity increases with X offset.

The blue LED intensity increases with Y offset.

Simply press any key to begin data output.


Sections of code taken from




There seem to be 'dead zones' while the board is tilted towards a corner.

The terminal will not output anything while in a 'dead zone'.


There will be a constant flicker of the LED even when the board is flat.

This is due to the accelerometer occasionally outputting 1 even when the board is static.