Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ProgettoAUC by
Revision 3:4ce3bb78b1fc, committed 2016-11-21
- Comitter:
- marcovitone
- Date:
- Mon Nov 21 12:13:28 2016 +0000
- Parent:
- 2:6b09752bd3b2
- Child:
- 4:98e062cf962e
- Commit message:
- ciao
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 02 10:57:29 2016 +0000 +++ b/main.cpp Mon Nov 21 12:13:28 2016 +0000 @@ -4,14 +4,19 @@ //Developed by Mazzella, Vitone, Tarallo I2C radio(D14, D15); //sda, sc1 +AnalogIn trimmer(PA_0);// A0 ingresso analogico Serial pc(USBTX, USBRX); //tx, rx InterruptIn button (USER_BUTTON); +char s; +float frequenza; +int N; const int addr = 0xC0; //address for writing data, reading is C1 char config_t[5]; char search[5]; +char lettura[5]; void seqfreq() //search next frequency, minimun signal strength @@ -22,11 +27,23 @@ search[3] = 0x12; search[4] = 0x00; radio.write(addr, search, 5); - + wait(0.01); + radio.read(0xC1, lettura,5);// dobbiamo azzerare i primi due bit + for(int i=0;i<2;i++){ + s=lettura[i]& 0x3F; + + + } + + int main() { + while (1){ + frequenza=(108-87.5)*trimmer.read()+87.5; + N=4*(frequenza+225000)/32768; + //a questo punto dobbiamo converitre in esadecimale N ed inviarlo al modulo radio config_t[0] = 0x2F; config_t[1] = 0xCA; // config data byte, tune at 100.00MHz