Advertisement
j0h

pdf_Array

j0h
Feb 8th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ST25DVSensor.h"
  2. #define SerialPort      Serial
  3.  
  4. #if defined(ARDUINO_B_L4S5I_IOT01A)
  5. // Pin definitions for board B-L4S5I_IOT01A
  6.   #define GPO_PIN PE4
  7.   #define LPD_PIN PE2
  8.   #define SDA_PIN PB11
  9.   #define SCL_PIN PB10
  10.   #define WireNFC MyWire
  11.   TwoWire MyWire(SDA_PIN, SCL_PIN);
  12.   ST25DV st25dv(12, -1, &MyWire);
  13. #else
  14.   #define DEV_I2C         Wire
  15.   ST25DV st25dv(12, -1, &DEV_I2C);
  16. #endif
  17. void clearNFCMemory() {
  18. //ok so one issue was that the buffer was not being cleared before writing new data to the tag.
  19.  st25dv.writeURI("", "", "");  // Write empty data to clear the memory
  20. }
  21. char *a[]= {
  22. "C.pdf",  
  23. "P.pdf",          
  24. "B.pdf",
  25. "L.pdf",      
  26. "A.pdf"
  27. };
  28. /*
  29. There is of course a solution that beats this, by loading a single actual webpage that handles getting random docs.
  30. just let the arduino monitor N reads and Energy. Would save a bunch of over head.
  31. */
  32. void setup() {
  33.  // SerialPort.begin(115200);
  34. st25dv.begin();
  35. clearNFCMemory(); //
  36. delay(1000);
  37. }
  38.  
  39.  
  40. void loop() {
  41.   String urlBase = "10.1.0.250/";
  42.   for (int i = 0; i < 5; i++) {
  43.     String completeURL = urlBase + a[i];  // Combine base and filename
  44.     char uriBuffer[128];                  
  45.     completeURL.toCharArray(uriBuffer, sizeof(uriBuffer));  
  46.     st25dv.writeURI(String(uriBuffer),"", "");  // Write the URI
  47.     delay(10000);  // 10-sec delay
  48.     clearNFCMemory();
  49.   }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement