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.
Fork of 4180_LSM9DS0_lab by
Revision 1:ae1cefe9aa38, committed 2015-01-26
- Comitter:
- aswild
- Date:
- Mon Jan 26 06:23:41 2015 +0000
- Parent:
- 0:29ab304ca8ce
- Child:
- 2:4d1fd40fbf43
- Commit message:
- updated skeleton code
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jan 26 01:43:00 2015 +0000
+++ b/main.cpp Mon Jan 26 06:23:41 2015 +0000
@@ -5,25 +5,35 @@
#include "LSM9DS0.h"
#include "uLCD_4DGL.h"
+// uncomment this line to enable the uLCD for Part 3 of the lab
+//#define PART_3
+
// SDO_XM and SDO_G are pulled up, so our addresses are:
#define LSM9DS0_XM_ADDR 0x1D // Would be 0x1E if SDO_XM is LOW
#define LSM9DS0_G_ADDR 0x6B // Would be 0x6A if SDO_G is LOW
-#define REFRESH_TIME_MS 50
+// refresh time. set to 500 for part 2 and 50 for part 3
+#define REFRESH_TIME_MS 500
// Verify that the pin assignments below match your breadboard
LSM9DS0 imu(p9, p10, LSM9DS0_G_ADDR, LSM9DS0_XM_ADDR);
-uLCD_4DGL lcd(p28, p27, p30);
-Serial pc(USBTX, USBRX); // tx, rx
+Serial pc(USBTX, USBRX);
+
+#ifdef PART_3
+uLCD_4DGL lcd(p28, p27, p30);X
+#endif
//Init Serial port and LSM9DS0 chip
void setup()
{
+#ifdef PART_3
lcd.baudrate(3000000);
lcd.background_color(0);
lcd.cls();
lcd.printf("Initializing...");
+#endif
+
// Use the begin() function to initialize the LSM9DS0 library.
// You can either call it with no parameters (the easy way):
uint16_t status = imu.begin();
@@ -41,7 +51,7 @@
while (true)
{
// TODO - add code here to read compass or accelerometer data
- // and display it on the uLCD
+ // and print it to the USB serial port (part 2) and display it on the uLCD (part 3)
// Compass Trigonometry tip: you can retrieve the compass heading (in degrees) directly from
// the IMU library. Example:
