4180 lab 1
Dependencies: mbed MCP23S17 PinDetect USBDevice
part9.h@12:cc5bda248946, 2020-01-22 (annotated)
- Committer:
- emilywilson
- Date:
- Wed Jan 22 13:08:48 2020 +0000
- Revision:
- 12:cc5bda248946
- Parent:
- 9:be04caf5f990
mouse extra credit and power management extra credit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilywilson | 7:b7720a8623b5 | 1 | #include "mbed.h" |
emilywilson | 7:b7720a8623b5 | 2 | |
emilywilson | 7:b7720a8623b5 | 3 | #define PI 3.14159265 |
emilywilson | 7:b7720a8623b5 | 4 | #define N_SAMPLES 20 |
emilywilson | 7:b7720a8623b5 | 5 | |
emilywilson | 7:b7720a8623b5 | 6 | AnalogOut aOut(pin); |
emilywilson | 7:b7720a8623b5 | 7 | |
emilywilson | 7:b7720a8623b5 | 8 | int run_part9() { |
emilywilson | 7:b7720a8623b5 | 9 | while (1) { |
emilywilson | 7:b7720a8623b5 | 10 | for (double i = 0; i < 2*PI; i += (2*PI/N_SAMPLES) { |
emilywilson | 9:be04caf5f990 | 11 | aOut = (sin(i) * 0.5) + 0.5; |
emilywilson | 7:b7720a8623b5 | 12 | } |
emilywilson | 7:b7720a8623b5 | 13 | } |
emilywilson | 7:b7720a8623b5 | 14 | } |