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.
main.cpp@22:dbd5c4af83d6, 2015-01-11 (annotated)
- Committer:
- m-limbird
- Date:
- Sun Jan 11 14:04:58 2015 -0500
- Revision:
- 22:dbd5c4af83d6
- Parent:
- 20:03a3357de805
- Child:
- 23:0baaa24e04d8
Moved pdfs
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mlimbird | 0:80725699690f | 1 | #include "mbed.h" |
| m-limbird | 22:dbd5c4af83d6 | 2 | #include "9DOF.h" |
| mlimbird | 8:c64f76d4deff | 3 | |
| mlimbird | 20:03a3357de805 | 4 | //establish I2C connections |
| m-limbird | 22:dbd5c4af83d6 | 5 | I2C i2c( p9, p10 ); |
| mlimbird | 8:c64f76d4deff | 6 | |
| mlimbird | 20:03a3357de805 | 7 | //establish serial communications with computer via usb |
| mlimbird | 8:c64f76d4deff | 8 | Serial pc(USBTX, USBRX); //tx, rx |
| mlimbird | 8:c64f76d4deff | 9 | |
| mlimbird | 20:03a3357de805 | 10 | //arrays to store data from 9DOF |
| mlimbird | 12:509ed716bd58 | 11 | int accelerometer_data[3]; |
| mlimbird | 16:1121b66ef27b | 12 | int gyro_data[3]; |
| mlimbird | 19:76632ff3e9fc | 13 | int magnetometer_data[3]; |
| mlimbird | 8:c64f76d4deff | 14 | |
| mlimbird | 0:80725699690f | 15 | int main() { |
| mlimbird | 8:c64f76d4deff | 16 | |
| mlimbird | 20:03a3357de805 | 17 | //initialize each IC |
| m-limbird | 22:dbd5c4af83d6 | 18 | //init_adxl345(i2c); |
| m-limbird | 22:dbd5c4af83d6 | 19 | init_itg3200(i2c); |
| m-limbird | 22:dbd5c4af83d6 | 20 | //init_hmc5883(i2c); |
| mlimbird | 9:331dbf3b341d | 21 | |
| mlimbird | 12:509ed716bd58 | 22 | while(1) { |
| mlimbird | 20:03a3357de805 | 23 | //read from each IC |
| m-limbird | 22:dbd5c4af83d6 | 24 | //read_adxl345(i2c, accelerometer_data); |
| m-limbird | 22:dbd5c4af83d6 | 25 | //pc.printf("ACCEL: %i\t%i\t%i", accelerometer_data[0], accelerometer_data[1], accelerometer_data[2]); |
| m-limbird | 22:dbd5c4af83d6 | 26 | read_itg3200(i2c, gyro_data); |
| m-limbird | 22:dbd5c4af83d6 | 27 | pc.printf("GYRO: %i\t%i\t%i", gyro_data[0], gyro_data[1], gyro_data[2]); |
| m-limbird | 22:dbd5c4af83d6 | 28 | //read_hmc5883(i2c, magnetometer_data); |
| m-limbird | 22:dbd5c4af83d6 | 29 | //pc.printf("Magnet: %i\t%i\t%i", magnetometer_data[0], magnetometer_data[1], magnetometer_data[2]); |
| mlimbird | 0:80725699690f | 30 | } |
| mlimbird | 19:76632ff3e9fc | 31 | } |