120_robot_H_Bridge8835_UserButton_DIR_PWM_I2C_LCD

Dependencies:   LCD_i2C_JDS

Committer:
itbusch
Date:
Mon Jan 31 17:02:41 2022 +0000
Revision:
0:3ace550537fc
Child:
1:821dba977886
120_robot_H_Bridge8835_DIR_PWM_I2C_LCD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
itbusch 0:3ace550537fc 1 /* mbed BuschA, */
itbusch 0:3ace550537fc 2 #include "mbed.h"
itbusch 0:3ace550537fc 3 #include "LCD.h"
itbusch 0:3ace550537fc 4 #include "LCD_Bua.h"
itbusch 0:3ace550537fc 5 // Set the LCD address to 0x27 for a 16 chars and 2 line display
itbusch 0:3ace550537fc 6
itbusch 0:3ace550537fc 7 DigitalIn CableSwitch(D2); //PullUp auf Board, PA_10
itbusch 0:3ace550537fc 8
itbusch 0:3ace550537fc 9
itbusch 0:3ace550537fc 10 int main()
itbusch 0:3ace550537fc 11 {
itbusch 0:3ace550537fc 12 mylcd.clear(); // LCD löschen
itbusch 0:3ace550537fc 13 M1_PWM.period_ms(10); // PWM-Periode
itbusch 0:3ace550537fc 14
itbusch 0:3ace550537fc 15 while (true)
itbusch 0:3ace550537fc 16 {
itbusch 0:3ace550537fc 17 if (CableSwitch == false)
itbusch 0:3ace550537fc 18 {
itbusch 0:3ace550537fc 19 M1_DIR = 1;
itbusch 0:3ace550537fc 20 M1_PWM = 0.5; //Tastgrad 0-1
itbusch 0:3ace550537fc 21 }
itbusch 0:3ace550537fc 22 else
itbusch 0:3ace550537fc 23 {
itbusch 0:3ace550537fc 24 M1_DIR = 1;
itbusch 0:3ace550537fc 25 M1_PWM = 0.95;
itbusch 0:3ace550537fc 26 }
itbusch 0:3ace550537fc 27 Ausgabe_LCD();
itbusch 0:3ace550537fc 28 thread_sleep_for(1000); //Sleep = Warten...
itbusch 0:3ace550537fc 29 }
itbusch 0:3ace550537fc 30 }
itbusch 0:3ace550537fc 31
itbusch 0:3ace550537fc 32