This is lab2 of 4180 dealing with the extra parts kit.
Dependencies: mbed LSM9DS1_Library_cal
Jesses_Lab2/Jesses_Main.cpp@4:1443e98048a6, 2016-02-12 (annotated)
- Committer:
- jbaker66
- Date:
- Fri Feb 12 17:40:06 2016 +0000
- Revision:
- 4:1443e98048a6
- Parent:
- 3:8e9172f7d119
- Child:
- 5:d3dfaed9fd93
new format for main JB
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jesse Baker |
2:4401fc907d45 | 1 | // <- remove this if you want to code this and comment Georges |
Jesse Baker |
2:4401fc907d45 | 2 | #include "mbed.h" |
Jesse Baker |
2:4401fc907d45 | 3 | |
jbaker66 | 4:1443e98048a6 | 4 | // -------------------------------------------------------------------------------- |
Jesse Baker |
2:4401fc907d45 | 5 | |
jbaker66 | 4:1443e98048a6 | 6 | //// AnalogOut sine wave complete |
jbaker66 | 4:1443e98048a6 | 7 | //AnalogOut aout(p18); |
jbaker66 | 4:1443e98048a6 | 8 | // |
jbaker66 | 4:1443e98048a6 | 9 | //int main(){ |
jbaker66 | 4:1443e98048a6 | 10 | // const double pi = 3.141592653589793238462; |
jbaker66 | 4:1443e98048a6 | 11 | // const double amplitude = 1; |
jbaker66 | 4:1443e98048a6 | 12 | // const double offset = 65535/2; |
jbaker66 | 4:1443e98048a6 | 13 | // double rads = 0.0; |
jbaker66 | 4:1443e98048a6 | 14 | // uint16_t sample = 0; |
jbaker66 | 4:1443e98048a6 | 15 | // |
jbaker66 | 4:1443e98048a6 | 16 | // while(1){ |
jbaker66 | 4:1443e98048a6 | 17 | // // sinewave output |
jbaker66 | 4:1443e98048a6 | 18 | // for (int i = 0; i < 360; i++) { |
jbaker66 | 4:1443e98048a6 | 19 | // rads = (pi * i) / 180.0f; |
jbaker66 | 4:1443e98048a6 | 20 | // sample = (uint16_t)(amplitude * (offset * (cos(rads + pi))) + offset); |
jbaker66 | 4:1443e98048a6 | 21 | // aout.write_u16(sample); |
jbaker66 | 4:1443e98048a6 | 22 | // } |
jbaker66 | 4:1443e98048a6 | 23 | // } |
jbaker66 | 4:1443e98048a6 | 24 | //} |
jbaker66 | 4:1443e98048a6 | 25 | // -------------------------------------------------------------------------------- |
jbaker66 | 3:8e9172f7d119 | 26 | |
jbaker66 | 4:1443e98048a6 | 27 | // Sharp IR sensor |
jbaker66 | 4:1443e98048a6 | 28 | |
jbaker66 | 4:1443e98048a6 | 29 | |
jbaker66 | 4:1443e98048a6 | 30 | int main(){ |