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.
Dependencies: Farbsensor IRSensorLib PID_Control Servo mbed PixyLib
Diff: main.cpp
- Revision:
- 8:077d0bb213a2
- Parent:
- 7:5949f408b6da
- Child:
- 9:b83994ef4b08
--- a/main.cpp Wed May 17 07:38:41 2017 +0000
+++ b/main.cpp Thu May 18 09:12:46 2017 +0000
@@ -6,7 +6,8 @@
#include "Farbauswertung.h"
#include "Fahren.h"
#include "liftAnsteuerung.h"
-#include "CamAusw.h"
+#include "Pixy.h"
+#include "PID_Control.h"
/**
*Aus- und Eingänge initialisieren
@@ -38,23 +39,33 @@
//Kamera
//Serielle Ausgabe
-Serial pc(SERIAL_TX,SERIAL_RX);
+Serial pc(SERIAL_TX,SERIAL_RX);
-Camauswertung cam(1);
+//Kamera
+Serial cam(PC_5, PB_10);
+Pixy pixy(cam);
+PID_Control pid;
+
+//Robotersteuerung
Farbauswertung farbauswertung(&SensorG, &SensorR, &ServoAusw);
-Fahren fahren(&enable, &bit0, &bit1, &bit2, &distance, &enableMotorDriver, &pwmLeft, &pwmRight, &cam);
+Fahren fahren(&enable, &bit0, &bit1, &bit2, &distance, &enableMotorDriver, &pwmLeft, &pwmRight, &pixy, &pid);
LiftAnsteuerung lift(100, 10, &ServoLift);
+
int main()
{
farbauswertung.setSerialOutput(&pc);
fahren.setSerialOutput(&pc);
+ pid.setPIDValues( 0.001f, 0.001f, 0.00015f, 0.3f, -0.3f, 1000);
- ServoLift = 1.2f; //1.2
+ //ServoLift = 1.2f; //1.2
ServoFoerder = 0.1f; //0.1
fahren.fahrInit();
+ //Ticker camausw;
+ //camausw.attach(&cam, &Camauswertung::auswertung, 0.5);
+
Ticker farbe;
farbe.attach(&farbauswertung, &Farbauswertung::auswertung, 0.01);
@@ -64,8 +75,7 @@
Ticker elevator;
elevator.attach(&lift, &LiftAnsteuerung::steuerung, 0.01);
- Ticker camausw;
- camausw.attach(&cam, &Camauswertung::auswertung, 0.01);
+
while (1) {