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 PES by
Revision 5:f48b2609c328, committed 2017-04-11
- Comitter:
- schneju2
- Date:
- Tue Apr 11 14:43:29 2017 +0000
- Parent:
- 4:fdcf3b5009c6
- Child:
- 6:4af735d26b7a
- Commit message:
- Main
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 11 11:47:04 2017 +0000
+++ b/main.cpp Tue Apr 11 14:43:29 2017 +0000
@@ -19,6 +19,10 @@
DigitalIn limitSwitch1(PA_10);
DigitalIn limitSwitch2(PB_13);
+//Periphery for Swich ON/OFF
+
+DigitalIn swichOnOFF (USER_BUTTON);
+
//motor stuff
DigitalOut enableMotorDriver(PB_2);
PwmOut pwmL( PA_8 );
@@ -31,25 +35,56 @@
int main()
{
- enable = 1;
- enableMotorDriver = 1;
-
- /*roboter1.kamera(); //Kameraauswertung
+ enable = 1; // Sensoren einschalten
+ enableMotorDriver = 1; // Schaltet die Motoren ein
+ pwmL->period(0.00005f); // Setzt die Periode auf 50 μs
+ pwmR->period(0.00005f);
+
+ int state = 0; // Diese Variable gibt an in welchem State man sich befindet
- while(cam=1) {
- roboter1.getBlock();
- wait(0.1f);
- }*/
+if ( kamera() == 1){ state = 4;) // Die Kamera erkennt ein grünen Klotz
+ while(1) {
- //while(cam==1 && camY>20) { //ausweichen aktive solange Y-Wert von Kamera grösser als 20
- roboter1.bandeAusweichen();
- wait(0.1f);
- //}
+ swich(state){
+
+ case 1: // Roboter Anschalten mit Knopf
+
+ if (swichOnOff == 1){
+ state = 2;}
+ if (swichOnOff ==0){
+ state =1;)
+
+ break;
+
+ case 2: // Im Kreis drehen
+
+ ....
+ break;
+
+ case 3: // gerade aus fahren
+
+ ....
+ break;
+
+ case 4: // Roboter erkennt gründer Klotz, Klotz wird angefahren
+
+ ...
+ break;
+
+ case 5: // Aufnehmen des Klotzes
+
+
+ .....
+ break;
+
+
+ default
+
+ ... break ; }
- //while(cam==0) { //im Kreis drehen bis Kamera einen Klotz sieht
- roboter1.findBlock();
wait(0.1f);
- //}
+
+ }
}
