Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Hcsr04_Libr.h
- Revision:
- 0:fa34a02fd39e
diff -r 000000000000 -r fa34a02fd39e Hcsr04_Libr.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Hcsr04_Libr.h Tue Mar 16 14:13:30 2021 +0000
@@ -0,0 +1,38 @@
+#ifndef HCSR04_LIBR_H
+#define HCSR04_LIBR_H
+
+#include "mbed.h"
+
+/*
+Hc-sr04 Library .h
+
+Version : 1.00
+Update date : 2019/11/16
+Designer : Watanabe Yuuto
+*/
+
+class Hcsr04_Libr{
+ Serial serial;
+public:
+ //(TXpin ,RXpin)
+ Serial_Libr(PinName _tx, PinName _rx);
+ //(Start ad of serial ,End ad of serial ,Number of serial's bytes ,Serial's baud)
+ void setup(char start_ad ,char end_ad ,char read_byts ,char send_byts ,int Baud);
+ bool read(unsigned char *read_data);
+ void send(unsigned char *send_data);
+
+ //This is used in read().
+ unsigned char cah_data();
+
+private:
+ Timer timer;
+
+ char START_ADDRESS,END_ADDRESS,READ_BYTS,SEND_BYTS;
+ unsigned char get_data[20];
+ unsigned char give_data[20];
+ unsigned char chksum;
+ int miss,i;
+
+};
+
+#endif
\ No newline at end of file