SCA3000 Accelerometer
Note
This page has been moved to the Components section of the website. Please see http://developer.mbed.org/components/SCA3000-Digital-Accelerometer/ .
SCA3000 triple axis digital interface accelerometer.
Hello World!¶
Import program
00001 #include "SCA3000.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 SCA3000 accelerometer(p5, p6, p7, p8, p9); 00005 00006 int main() { 00007 00008 pc.printf("Starting SCA3000 test...\n"); 00009 00010 int revision = accelerometer.getRevId(); 00011 00012 pc.printf("Device revision number is: %i.%i\n", revision & 0xF0, revision & 0x0F); 00013 00014 00015 while(1){ 00016 00017 //Arbitrary wait for printf clarity. 00018 wait(0.1); 00019 00020 //Print out the acceleration measured on each axis in milli-gs. 00021 pc.printf("x:%f y:%f z:%f\n", accelerometer.getAcceleration(SCA3000_X_AXIS), 00022 accelerometer.getAcceleration(SCA3000_Y_AXIS), 00023 accelerometer.getAcceleration(SCA3000_Z_AXIS)); 00024 00025 } 00026 00027 }
SCA3000 Signal Name | mbed pin |
---|---|
Vcc | Vout |
Gnd | Gnd |
MOSI | p5 |
MISO | p6 |
SCK | p7 |
CSB | p8 |
RST | p9 |
Warning
The library is pretty bare bones at the moment. At the moment you can only get the acceleration values on each axis, but the device has a lot more functionality than that. I'll try and get round to adding in the extra features available to the library when I have some time.
API¶
Import library
Public Member Functions |
|
SCA3000 (PinName mosi, PinName miso, PinName sck, PinName cs, PinName nr) | |
Constructor.
|
|
int | getRevId (void) |
Read the revision ID register on the device.
|
|
float | getAcceleration (int axis) |
Get the register contents acceleration value for the given axis, using the nominal sensitivity values found in the datasheet.
|
|
int | getCounts (int axis) |
Get the register contents acceleration value for the given axis, in counts.
|
Library¶
Import librarySCA3000
SCA3000 triple axis digital interface accelerometer