ultrasonic.hpp 328 B

12345678910111213141516171819202122
  1. #ifndef ULTRASONIC_H
  2. #define ULTRASONIC_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #define US_RX_0_PIN 2
  6. #define US_RX_1_PIN 3
  7. #define US_TX_0_PIN 4
  8. struct usData_t {
  9. uint32_t pulseStart;
  10. long duration;
  11. bool rxPending;
  12. bool newData;
  13. };
  14. void us_init();
  15. void us_transmit();
  16. long us_get_duration(byte sensor);
  17. #endif