Software part two



The Sun SPOT was used for two things, to establish the direction of the cannon in terms of rotation on its Z-axis and to establish the angle of the cannon. The built in accelerometer was used to get the angle of the cannon. To get the angle from the accelerometer we used the following code,

import com.sun.spot.sensorboard.peripheral.LIS3L02AQAccelerometer;



private LIS3L02AQAccelerometer acc;

acc = (LIS3L02AQAccelerometer)EDemoBoard.getInstance().getAccelerometer();

int tilt = (int)Math.toDegrees(acc.getTiltY());

Inga kommentarer:

Skicka en kommentar