Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: PositionSetter.cpp
- Revision:
- 0:a4ad8cb94c43
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PositionSetter.cpp Thu Nov 12 03:53:37 2015 +0000 @@ -0,0 +1,24 @@ +#include "PositionSetter.h" + +PositionSetter::PositionSetter() { + // when no arguments, set to default + // 3 axes (or motors )with 5 positions + NofAxes = 3; + NofPositions = 5; + // first allocate memory + // for Position + Position = (Degree **) malloc(sizeof(Degree *) * NofAxes); + for (int i = 0; i < NofAxes; i++) { + Position[i] = (Degree *) malloc(sizeof(Degree) * NofPositions); + } + // for Duration + Duration = (Time *) malloc(sizeof(Time) * NofPositions); + Write = (bool *) malloc (sizeof(bool) * NofPositions); + for (int i = 0; i < NofPositions; i++) { + for (int j = 0; j < NofAxes; j++) { + Position[j][i] = (Degree) i*j; + } + Duration[i] = (Time) i; + Write[i] = true; + } +} \ No newline at end of file