2626 */
2727
2828// Includes
29- #include < tinyio .h>
29+ #include < simpletools .h>
3030#include " L3G_Demo.h"
3131
3232// Main function
@@ -36,7 +36,9 @@ int main () {
3636 PropWare::SPI *spi = PropWare::SPI::getInstance ();
3737 PropWare::L3G gyro (spi);
3838
39- if ((err = gyro.start (MOSI, MISO, SCLK, CS, PropWare::L3G::DPS_2000)))
39+ if ((err = gyro.start (MOSI, MISO, SCLK, CS)))
40+ error (err);
41+ if ((err = gyro.set_dps (PropWare::L3G::DPS_500)))
4042 error (err);
4143
4244 // Though this functional call is not necessary (default value is 0), I
@@ -49,17 +51,20 @@ int main () {
4951 while (1 ) {
5052 if ((err = gyro.read_all (gyroVals)))
5153 error (err);
52- printf (" Gyro vals... X: %i\t Y: %i\t Z: %i\n " , gyroVals[0 ], gyroVals[1 ],
53- gyroVals[2 ]);
54- waitcnt (CLKFREQ/20 + CNT);
54+ print (" Gyro vals DPS... X: %2.3f\t Y: %2.3f\t Z: %2.3f\n " ,
55+ gyro.convert_to_dps (gyroVals[0 ]),
56+ gyro.convert_to_dps (gyroVals[1 ]),
57+ gyro.convert_to_dps (gyroVals[2 ]));
58+
59+ // waitcnt(50*MILLISECOND + CNT);
5560 }
5661
5762 return 0 ;
5863}
5964
6065void error (const PropWare::ErrorCode err) {
6166 // Set the Quickstart LEDs for output (used to display the error code)
62- PropWare::SimplePort debugLEDs (PropWare::Pin ::P16, 8 , PropWare::Pin::OUT);
67+ PropWare::SimplePort debugLEDs (PropWare::Port ::P16, 8 , PropWare::Pin::OUT);
6368
6469 while (1 ) {
6570 debugLEDs.write (err);
0 commit comments