Lehrer Busch
/
150_robot_H_Bridge8835_DIR_PWM_US_Follow
150_robot_H_Bridge8835_DIR_PWM_US_Follow
Revision 0:68a3b91ee2a4, committed 2022-02-23
- 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
--- /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
--- /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
--- /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
--- /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
--- /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
Binary file resources/official_armmbed_example_badge.png has changed