NRF: receive, ntp, Data to Sd-card working

Dependencies:   F7_Ethernet mbed BSP_DISCO_F746NG Test_Mainboard SDFileSystem RF24

Files at this revision

API Documentation at this revision

Comitter:
lowlowry
Date:
Sun Jun 20 13:48:06 2021 +0000
Parent:
3:1c6da30ca347
Commit message:
NRF: receive, ntp, Data to Sd-card working

Changed in this revision

Test_Mainboard.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1c6da30ca347 -r 5ecb71f149bf Test_Mainboard.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test_Mainboard.lib	Sun Jun 20 13:48:06 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/HT-TEAM/code/Test_Mainboard/#1c6da30ca347
diff -r 1c6da30ca347 -r 5ecb71f149bf main.cpp
--- a/main.cpp	Tue Jun 08 16:21:16 2021 +0000
+++ b/main.cpp	Sun Jun 20 13:48:06 2021 +0000
@@ -9,7 +9,7 @@
 #include "RF24.h"
 const uint64_t  ADDRESS = 0xF0F0F0F0F0F0F001L;
 
-RF24            radio(A2, A3, A4, D4, D2);    // SPI5 mosi, miso, sck, csn, ce (irq unused)
+RF24            radio(A2, A3, A4, D4, D2);    // SPI5 mosi, miso, sck, csn, ce (irq unused) (PINS DISCO)
 
 struct MyData 
 {
@@ -23,9 +23,6 @@
 
 
 
-
-
-
 EthernetInterface eth;
 DigitalOut myled(LED1);
 SDFileSystem sd("sd");
@@ -43,11 +40,7 @@
 
 int main(void) { 
     
-    int temp_array[1]; // Nur zum Test
-    temp_array[0]= 123; // Nur zum Test
-    temp_array[1]= 124;// Nur zum Test
-    
-    
+
     if (!radio.begin()) {
         printf("Failed to initialize nRF24L01. Check whether connected.\r\n");
         return -1;  // Exit the program
@@ -64,7 +57,7 @@
     sd.mount(); 
     FILE *fp;
     NTPClient ntp;
-    char buff[64];
+ //   char buff[64];
     
         if(eth.init()!=0)                    //for DHCP Server
     {
@@ -84,18 +77,19 @@
             fprintf(fp,"EthernetInterface Connect Error \r\n");
         }
     }
+           
     
-        
-    int x;
-     
-     
-     // for (x=1; x<6;x++){
-         
-         
+    fp = fopen("/sd/test.txt", "a");
+
+    fprintf(fp,"board: , counter, temperature, time, \r\n");
+    
+    fclose (fp); 
+
+       
+                
          while (1) {
         
-        printf("laeuft\r\n");
-        wait(1);
+ 
          
             if (radio.available()) {
             radio.read(&data, sizeof(MyData)); // read message and send acknowledge back to the master
@@ -111,11 +105,12 @@
 
             
         
-    /*
+    
      
      
        fp = fopen("/sd/test.txt", "a");
-        
+     
+       
         if (fp == NULL)
         {
             printf("open error!!\r\n");
@@ -137,7 +132,8 @@
     {
         time_t ctTime;
         ctTime = time(0);
-        fprintf(fp,"Temperatur:%i; %s" , temp_array[0], ctime(&ctTime));
+        fprintf(fp,"%i, %i, %i, " , data.board, data.counter, data.temperature);
+        fprintf(fp,"%s" , ctime(&ctTime));
         
     }
     else
@@ -148,8 +144,9 @@
    
         
     } 
+    
    
-    
+    /*
         fp = fopen("/sd/test.txt", "r");
         if (fp == NULL)
         {
@@ -164,11 +161,13 @@
             printf("%s\r\n", buf);
         }
 
+
         // file close
         fclose(fp);
         
         */
+        
         }
         
 }
-}
+