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.
main.cpp
- Committer:
- georgjonak
- Date:
- 2016-06-06
- Revision:
- 0:91e9dc4737ca
File content as of revision 0:91e9dc4737ca:
#include "mbed.h"
DigitalOut Von (P2_13); // Motor Spannung ab BERTL15 nötig !
DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR !
DigitalOut MotorL_FORWARD(P2_14); // Forwerts
DigitalOut MotorL_REVERSE(P2_15); // Rückwerts
DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor
DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor
DigitalOut MotorR_REVERSE(P2_20);
DigitalIn TA1 (P1_23);
DigitalIn TA2 (P1_24);
DigitalIn TA3 (P1_25);
DigitalIn TA4 (P1_26);
DigitalIn TA5 (P1_27);
DigitalIn TA6 (P1_28);
DigitalIn TA7 (P1_30);
DigitalIn TA8 (P1_31);
DigitalOut LedD6 (P1_14);
DigitalOut LedD7 (P1_15);
DigitalOut LedD8 (P1_16);
DigitalOut LedD9 (P1_17);
int main() { // Start Hauptprogramm
Von=1; // Motor Spannung EIN
MotorR_EN=MotorL_EN=1;
while(1) {
if (TA8==1){ //ggf
MotorL_REVERSE=1;
MotorR_REVERSE=1;
LedD7 = 1;
LedD9 = 1;
}else {
{
LedD7 = 0;
LedD9 = 0;
MotorL_REVERSE=0;
MotorR_REVERSE=0;
MotorR_FORWARD=1;
MotorL_FORWARD=1;
wait(0.5);
MotorL_FORWARD=0;
wait(0.5);
MotorR_FORWARD=0;
MotorL_REVERSE=1;
MotorR_REVERSE=1;
}}
if (TA3==1){ //ggf
MotorL_REVERSE=1;
MotorR_REVERSE=1;
LedD7 = 1;
LedD9 = 1;
}else {
{
LedD7 = 0;
LedD9 = 0;
MotorL_REVERSE=0;
MotorR_REVERSE=0;
MotorR_FORWARD=1;
MotorL_FORWARD=1;
wait(0.5);
MotorL_FORWARD=0;
wait(0.5);
MotorR_FORWARD=0;
MotorL_REVERSE=1;
MotorR_REVERSE=1;
}}
if (TA7==1){ //ggf
MotorL_REVERSE=1;
MotorR_REVERSE=1;
LedD7 = 1;
LedD9 = 1;
}else {
{
LedD7 = 0;
LedD9 = 0;
MotorL_REVERSE=0;
MotorR_REVERSE=0;
MotorR_FORWARD=1;
MotorL_FORWARD=1;
wait(0.5);
MotorR_FORWARD=0;
wait(0.5);
MotorL_FORWARD=0;
MotorL_REVERSE=1;
MotorR_REVERSE=1;
}}
if (TA2==1){ //ggf
MotorL_REVERSE=1;
MotorR_REVERSE=1;
LedD7 = 1;
LedD9 = 1;
}else {
{
LedD7 = 0;
LedD9 = 0;
MotorL_REVERSE=0;
MotorR_REVERSE=0;
MotorR_FORWARD=1;
MotorL_FORWARD=1;
wait(0.5);
MotorR_FORWARD=0;
wait(0.5);
MotorL_FORWARD=0;
MotorL_REVERSE=1;
MotorR_REVERSE=1;
}}
} }