111

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

Fork of 4180_proj by ECE4180proj

main.cpp

Committer:
hanjiex
Date:
2015-12-07
Revision:
12:b6265952fb06
Parent:
11:d21c2da8b290
Child:
13:4cec0e446def

File content as of revision 12:b6265952fb06:

/* 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>
#include <string>
#include <list>
#include <mpr121.h>

/**********************************************
----- Objects for devices----------------------
**********************************************/





// function generator
AD5206 digipot(p5, p6, p7,p8);//MOSI, MISO, CLK, CS'
Serial funGen(p28, p27);
para thispara;

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