Synthesizer / Mbed 2 deprecated DBSMUSICPROJ2

Dependencies:   mbed

main.cpp

Committer:
liam_grazier
Date:
2019-07-11
Revision:
0:951442bd3f7f
Child:
1:5b491fa83cb7

File content as of revision 0:951442bd3f7f:

#include "mbed.h"
#include "main.hpp"

int main() {
    float meas; 
  while(1) {    
    cs = 1;
    dac.format(32,1);
    dac.frequency(50000000);
wait(0.5);
    cs = 0;
    dac.write(0x30FFFF);
    wait(0.5);
    allledon();
   updateled();
    multiplexa = 0;
    meas = analog_valuea.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
    meas = meas * 3300; // Change the value to be in the 0 to 3300 range
    printf("measure = %.0f mV\n", meas);
    if (meas > 2000) { // If the value is greater than 2V then switch the LED on
        led = 1;
        }
        else {
          led = 0;
//        }
    }
}
    }