4180 lab 1

Dependencies:   mbed MCP23S17 PinDetect USBDevice

part9.h

Committer:
emilywilson
Date:
2020-01-21
Revision:
7:b7720a8623b5
Child:
9:be04caf5f990

File content as of revision 7:b7720a8623b5:

#include "mbed.h"

#define PI 3.14159265
#define N_SAMPLES 20

AnalogOut aOut(pin);

int run_part9() {
    while (1) {
        for (double i = 0; i < 2*PI; i += (2*PI/N_SAMPLES) {
            aOut = (sin(i) + 1.0) * (3.3 / 2.0);
            wait(0.1);
        }
    }
}