Basic_sine_wave_generator

Dependencies:   mbed 4DGL-uLCD-SE mbed-rtos AD5206

main.cpp

Committer:
hanjiex
Date:
2015-12-02
Revision:
11:d21c2da8b290
Parent:
10:159f38636ed4

File content as of revision 11:d21c2da8b290:

/* ECE4180 Final Project -- mbed Function Generator
    
   Platform: mbed LPC-1768
    
   Team member: Hanjie Xie
                Qiuyang Tao
                Xuefeng Jin
                Yuqing Peng
*/

//#include "wave.h"
#include "mbed.h"
#include "menu.h"
#include "para.h"
#include "uLCD_4DGL.h"
#include <AD5206.h>
//----- Objects for devices----------------------
Serial funGen(p28, p27);
DigitalOut led1(LED1);
AD5206 digipot(p5, p6, p7,p8);//MOSI, MISO, CLK, CS'
Serial pc(USBTX, USBRX);

para thispara;

int vol;
int main(void){
    pc.printf("1111");
    int  start = begain_first();
    if (start) {
        thispara = para_setting();
        int type=thispara.get_type();
        vol = thispara.get_amp() * 100;
        float freq = thispara.get_freq();
        while (1){
            //funGen.printf("%d,%f\n", type, freq);
            pc.printf("%d",type);
        //change gain of the opamp, in order to change output amplitude
            
            digipot.write_AD5206(0, vol);
            //val=val+10;
            //if (val>=255){val=0;}
            wait(1);
        }
    }
}