150_robot_H_Bridge8835_DIR_PWM_US_Follow

Dependencies:   HC-SR04

Files at this revision

API Documentation at this revision

Comitter:
itbusch
Date:
Wed Feb 23 18:55:12 2022 +0000
Commit message:
150_robot_H_Bridge8835_DIR_PWM_US_Follow

Changed in this revision

HC-SR04.lib Show annotated file Show diff for this revision Revisions of this file
LCD_Bua.h Show annotated file Show diff for this revision Revisions of this file
UP_US_Sensor.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
resources/official_armmbed_example_badge.png Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 68a3b91ee2a4 HC-SR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC-SR04.lib	Wed Feb 23 18:55:12 2022 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Nestordp/code/HC-SR04/#d1d7bb1c1f6c
diff -r 000000000000 -r 68a3b91ee2a4 LCD_Bua.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_Bua.h	Wed Feb 23 18:55:12 2022 +0000
@@ -0,0 +1,9 @@
+
+
+void Ausgabe_LCD (Abstand)
+{
+    mylcd.cursorpos(0x00);
+    mylcd.printf(" Hallo robot");
+    mylcd.cursorpos(0x40);
+    mylcd.printf("Distanz: %.2f", Abstand);
+}
\ No newline at end of file
diff -r 000000000000 -r 68a3b91ee2a4 UP_US_Sensor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UP_US_Sensor.h	Wed Feb 23 18:55:12 2022 +0000
@@ -0,0 +1,8 @@
+
+
+ 
+ void Abstandsmessung (void)
+ {
+         float Abstand = sonar.getCm();
+       
+}
\ No newline at end of file
diff -r 000000000000 -r 68a3b91ee2a4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 23 18:55:12 2022 +0000
@@ -0,0 +1,35 @@
+/* mbed BuschA */
+#include "mbed.h"
+#include "HCSR04.h" //US-Sensor Abstand
+#include "UP_US_Sensor.h"
+
+lcd mylcd;
+HCSR04 sonar(D2, D4);   //Echo, Trigger Pin
+DigitalIn CableSwitch(D2); //PullUp auf Board, PA_10
+PwmOut M1_PWM(D9);          
+DigitalOut M1_DIR(D7);
+
+int main()
+{
+  M1_PWM.period_ms(10);        // PWM-Periode
+  M1_DIR = 1;                  // Vorwärts...
+  M1_PWM = 0.8;                //Start-Speed
+  float Abstand;
+    while (1) 
+    {
+
+    Abstandsmessung();    //Abstand in cm 
+    
+        switch (Abstand)
+        {
+            case 50:     M1_PWM = 0.1; break;
+            case 100:    M1_PWM = 0.3; break;
+            case 150:    M1_PWM = 0.5; break;
+            case 200:    M1_PWM = 0.7; break;
+            case 250:    M1_PWM = 0.9; break;
+            case 300:    M1_PWM = 1.0; break;
+        }
+    
+    }
+    thread_sleep_for(200); //Sleep = Warten...
+}
\ No newline at end of file
diff -r 000000000000 -r 68a3b91ee2a4 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Feb 23 18:55:12 2022 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#b1796dedeb8accde1cbaecf136fab96895e23d81
diff -r 000000000000 -r 68a3b91ee2a4 resources/official_armmbed_example_badge.png
Binary file resources/official_armmbed_example_badge.png has changed