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.
Fork of Versuch21 by
Diff: main.cpp
- Revision:
- 5:93d3efe46493
- Parent:
- 4:3c6d2c035243
--- a/main.cpp Tue May 01 11:42:38 2018 +0000
+++ b/main.cpp Wed May 09 13:33:59 2018 +0000
@@ -23,8 +23,6 @@
AnalogIn sensorValue4(PB_1); // Seitlicher Sensor links
AnalogIn sensorValue5(PA_4); // Seitlicher Sensor rechts
AnalogIn sensorValue6(PB_0); // Helligkeitssensor
-//DigitalOut myled(LED1); // LED 1
-//InterruptIn button(USER_BUTTON); // Startknopf
DigitalIn mybutton(USER_BUTTON);
DigitalOut myled(LED1);
DigitalOut power_5v(PC_4); // 5V auf Sensoren, geschalten
@@ -35,15 +33,14 @@
DigitalIn motorDriverFault(PB_14);
DigitalIn motorDriverWarning(PB_15);
-PwmOut pwmRight(PA_8);
-PwmOut pwmLeft(PA_9);
+PwmOut pwmRight(PA_9);
+PwmOut pwmLeft(PA_8);
EncoderCounter counterLeft(PB_6, PB_7);
EncoderCounter counterRight(PA_6, PC_7);
//------------------------------------------------------------------------------
-Controller controller(pwmLeft, pwmRight, counterLeft, counterRight);
// Grosse Sensoren aufrufen
IRSensorGF Sensor1(sensorValue1);
@@ -59,6 +56,7 @@
int main()
{
+ Controller controller(pwmLeft, pwmRight, counterLeft, counterRight);
power_5v = 1; // Einschalten 5V Speisung der Sensoren
enable = 1;
enableMotorDriver = 1; //Schaltet den Leistungstreiber ein
@@ -73,8 +71,14 @@
while (1) {
D = LHR.moving();
motion.switching(D);
- wait(0.2);
+ /*printf("Sensor1:%d\r\n", Sensor1.read());
+ printf("Sensor2:%d\r\n", Sensor2.read());
+ printf("Sensor3:%d\r\n", Sensor3.read());
+ printf("Sensor4:%d\r\n", Sensor4.read());
+ printf("Sensor5:%d\r\n", Sensor5.read());
+ printf("\r\n");*/
+ wait(0.05f);
}
}
}
- }
+}
