Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. DateTime now = RTC.now();
  2.  
  3. filename[0] = (now.year() / 1000) % 10 + '0'; //To get 1st digit from year()
  4.  
  5. filename[1] = (now.year() / 100) % 10 + '0'; //To get 2nd digit from year()
  6.  
  7. filename[2] = (now.year() / 10) % 10 + '0'; //To get 3rd digit from year()
  8.  
  9. filename[3] = now.year() % 10 + '0'; //To get 4th digit from year()
  10.  
  11. filename[4] = now.month() / 10 + '0'; //To get 1st digit from month()
  12.  
  13. filename[5] = now.month() % 10 + '0'; //To get 2nd digit from month()
  14.  
  15. filename[6] = now.day() / 10 + '0'; //To get 1st digit from day()
  16.  
  17. filename[7] = now.day() % 10 + '0'; //To get 2nd digit from day()
  18.  
  19. Serial.println(filename);
  20.  
  21. Serial.println("nyeeee");
  22. int x = 0;
  23.  
  24.  
  25. //-----------------------------------------------------
  26.  
  27.  
  28.  
  29. Serial.println("siker2");
  30.  
  31. // sprintf(data, "asd/%s", myName);
  32. Serial.println(data);
  33.  
  34. //O_RDWR - open for reading and write
  35. //o_creat - If the file exists, this flag has no effect except as noted under O_EXCL below. Otherwise, the file shall be created
  36. //O_AT_END - Set the initial position at the end of the file.
  37.  
  38.  
  39. if (writeFile.open(filename, O_RDWR | O_CREAT | O_AT_END))
  40. {
  41. Serial.print("omg");
  42. writeFile.close();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement