labSPI

Dependencies:   mbed

Fork of MCP4922_Sinewave by FRA221_2015

main.cpp

Committer:
butsaba
Date:
2015-11-05
Revision:
3:863a9b7d417a
Parent:
2:2244c8986987
Child:
4:1a2a74472be9

File content as of revision 3:863a9b7d417a:


#include "mbed.h"
#include "MCP4922.h"

MCP4922 MCP(SPI_MOSI, SPI_SCK,SPI_CS);  // MOSI, SCLK, CS


/**** Main Function  ***/
int main(void)
{
    MCP.frequency(1000000);
    int i;
    float a,y;
    while(1) {
          
          
                  for(a=1;a<=360;a++)
                  { 
                     y= sin(a*(6.28/360));
                    MCP.writeA((y+1)*2000);
               }
               

    }
}