prjbrook

globals.h for spudSensor94

Sep 17th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. /* globals.h for SpudSensor94.ino.*/
  2. */
  3. uint8_t broadcastAddress[] ={0x98,0xF4,0xAB,0xBF,0xEC,0xCC}; //Mac address of Wemos2
  4. //{0x18,0xFE,0x34,0xF9,0x2E,0x4A} ; //Mac address of Wemos1
  5.  
  6. // Define variables to store Sensor readings to be sent to Master
  7. float temperature;
  8. float humidity;
  9. unsigned long milliSecsA;
  10. uint8_t orders;
  11. uint8_t stack[10];
  12. uint8_t stackPtr;
  13. uint8_t bufferPtr;
  14. uint8_t bigBuffer[200];
  15.  
  16. // Define variables to store incoming readings from Master
  17. float incomingTemp;
  18. float incomingHum;
  19. unsigned long incomingMillisA;
  20. uint8_t incomingOrders;
  21. uint8_t incomingStac[10];
  22. uint8_t incomingStackPtr;
  23. uint8_t incomingBufferPtr;
  24. uint8_t incomingBigBuffer[200];
  25.  
  26.  
  27. int globLen = 0; //holds length of incoming packet
  28. const long interval = 500; //5000;
  29. unsigned long previousMillis = 0; // will store last time Sensor was updated
  30. uint8_t RxFlag =0; //goes high when data packet from SpudMaster received
  31. char buffer[200]; //intermediate buffer to store readings until big enough to append to log file. Also can send buffer via espNow to boss.
  32. char text[20]; //might have to be global
  33. uint16_t numReadings=0; //counts number of times HTU21D read.
  34. int testing = 1;
  35. unsigned long onDataRecvMillis=0;
  36. unsigned long loopCounter=0; //like to see how many times empty loop circulaes before sending espNow packet
  37. unsigned long stopWatchSettings[10]; //holds times during running of programs.
  38.  
  39. //Structure example to send data
  40. //Must match the receiver structure
  41. typedef struct struct_message {
  42. float temp;
  43. float hum;
  44. unsigned long millisA; //for timing
  45. uint8_t ord;
  46. uint8_t stac[10];
  47. uint8_t stacPtr;
  48. uint8_t bufPtr;
  49. uint8_t bigBuf[200];
  50. } struct_message;
  51.  
  52. // Create a struct_message called sensorReadings to hold sensor readings; to be sent to master
  53. struct_message sensorReadings;
  54.  
  55. // Create a struct_message to hold incoming master readings
  56. struct_message incomingReadings;
  57.  
Advertisement
Add Comment
Please, Sign In to add comment