posilani dat

Dependencies:   FatFileSystemCpp mbed PowerControl USBHostLite

Revision:
4:030c7726c7dc
Parent:
2:f623d1815dc4
Child:
5:83f69916e571
--- a/main.cpp	Tue Mar 17 19:01:52 2015 +0000
+++ b/main.cpp	Sun Apr 19 18:16:51 2015 +0000
@@ -7,13 +7,16 @@
 #include "L3GD20.h"
 #include "adc.h"
 #include "utils.h"
-#include "RF.h"
+#include "wifi.h"
 #include <stdio.h>
 
+#define SSID                "test"
+#define PASS                "1234"
+#define SECURITY            WPA
 #define SAMPLE_RATE         750000                          // S mple rate for ADC conversion
 #define PERIOD              0.01                            // Setting the period of measuring, 0.01 menas 100 times per second
 #define SIZE                1000                            // Setting number of instance in array - for saving to SD card
-
+#define BUFFER_SIZE        (sizeof(int)*4 + sizeof(float)*3)
 
 #define SAVING_START 'S'
 #define SAVING_STOP 'E'
@@ -44,7 +47,7 @@
 
 SDCard Logger(p5, p6, p7, p8, "SDCard");                // Initialise the SD Card to SPI interface
 ADC adc(SAMPLE_RATE, 1);                                // Initialise ADC to maximum SAMPLE_RATE and cclk divide set to 1   originally MMA7361L
-RF nRF(p11, p12, p13, p14, p15);                        // Connecting of wireless module nRF24L01P to SPI
+Wifi wifi(p13, p14, p11, p11, SSID, PASS);    // Wifly module
 Ticker Saving_Ticker;                                   // Tickers for interrupts on measuring
 I2C i2c(p28, p27);                                      // NEW function GYRO connection                                     originally L3G4200D
      
@@ -192,7 +195,7 @@
 
     for (i = 0; i < swimmer_id; i++) {
         sprintf(name, "/SDCard/swimmer%d.txt", i);
-        if (nRF.sendFile(name, i)) {
+        if (wifi.sendFile(name, i)) {
             leds_error();
             printf("\nUnable to send data\n\r");
         }  
@@ -212,13 +215,13 @@
     adc.setup(p20,1);                                   // Set up ADC on pin 20    
 
     sprintf(fname, "/SDCard/swimmer%d.txt", swimmer_id);
-    remove(fname);  //remove file to avoid reading old data
+    //remove(fname);  //remove file to avoid reading old data
     
     leds_off();
     printf("Ready...\n\r");
     
     while (1) {
-        char cmd = nRF.getCmd();
+        char cmd = wifi.getCmd();
         
         switch (cmd) {
         /* start measuring data periodically and save them info file */