test
Dependencies: F7_Ethernet mbed BSP_DISCO_F746NG SDFileSystem RF24
Diff: main.cpp
- Revision:
- 1:6210d492bda7
- Parent:
- 0:d984976f1f1c
- Child:
- 3:1c6da30ca347
--- a/main.cpp Tue Jun 08 10:06:19 2021 +0000 +++ b/main.cpp Tue Jun 08 14:40:37 2021 +0000 @@ -27,8 +27,8 @@ int main() { int temp_array[1]; // Nur zum Test - temp_array[0]= 123; - temp_array[1]= 124; + temp_array[0]= 123; // Nur zum Test + temp_array[1]= 124;// Nur zum Test @@ -46,6 +46,7 @@ while (1) { + fprintf(fp,"EthernetInterface Initialize Error \r\n"); } } if(eth.connect()!=0) @@ -53,6 +54,7 @@ printf("EthernetInterface Connect Error \r\n"); while (1) { + fprintf(fp,"EthernetInterface Connect Error \r\n"); } } @@ -61,6 +63,8 @@ for (x=1; x<6;x++){ + + fp = fopen("/sd/test.txt", "a"); if (fp == NULL) @@ -71,8 +75,6 @@ //////////////////////////////////////// Ethernet connection for timestamp//////////////////////////////////////////////////////////////// - printf("Durchlauf\n"); - // printf("IP Address is %s\r\n", eth.getIPAddress()); // printf("NetMask is %s\r\n", eth.getNetworkMask()); // printf("Gateway Address is %s\r\n", eth.getGateway()); @@ -81,14 +83,13 @@ - wait(1); - if (ntp.setTime("0.uk.pool.ntp.org") == 0) + //if (ntp.setTime("1.pool.ntp.org") == 0) + if (ntp.setTime("ntp0.freenet.de") == 0) { time_t ctTime; - ctTime = time(NULL); - fprintf(fp,"Time:%s \r", ctime(&ctTime)); - fprintf(fp,"Temp:%i; ", temp_array[0]); - printf("Hole Uhrzeit\n"); + ctTime = time(0); + fprintf(fp,"Temperatur:%i; %s" , temp_array[0], ctime(&ctTime)); + } else { @@ -117,6 +118,4 @@ // file close fclose(fp); - - }