Drives a Quater with White Leds #Bertl

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Nicholas_
Date:
Mon Jun 15 11:48:30 2015 +0000
Commit message:
mbed_Rechteck_LED_Weiss

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 984509832f85 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 15 11:48:30 2015 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+DigitalOut Von (P1_2);           // Motor Spannung ab BERTL15 nötig !
+DigitalOut MotorL_EN(P1_15);     // Enable    
+DigitalOut MotorL_REVERSE(P1_1); // Forwerts  
+DigitalOut MotorL_FORWARD(P1_0); // Rückwerts  
+
+DigitalOut MotorR_EN(P0_21);     //Die Leitung führt zum Pin PO_21 am Prozessor
+DigitalOut MotorR_REVERSE(P1_3); //Die Leitung führt zum Pin P1_3 am Prozessor
+DigitalOut MotorR_FORWARD(P1_4);
+
+int main() {
+     Von=1;                       // Motor Spannung EIN
+    MotorR_EN=MotorL_EN=1; 
+    while(1) {
+        MotorR_FORWARD = MotorL_FORWARD = 1;  // Beide Motoren vorwärts EIN
+        wait (1.0); 
+         MotorR_FORWARD = MotorL_FORWARD = 0;
+         wait (0.5);
+         MotorR_FORWARD = 1;
+         wait (0.58);
+         MotorR_FORWARD = 0;
+         wait (0.5);
+         
+         I2C i2c(p28, p27);
+DigitalOut Von (P1_2);
+
+ Von = 1;
+         
+         i2c.start();
+       i2c.write(0x40);   // Adresse des PCA9555 = 40 
+                          // das letzte Bit = 0 -> schreiben  0040 0000
+       i2c.write(0x06);   // Befehl für das IO Port 0 -> siehe SCHEMA des PCA9555
+       i2c.write(0x00);   // Schalte alle Pins des Ports als OUTPUT
+    i2c.stop();   
+    
+     i2c.start();
+                i2c.write(0x40);  // Adresse & schreiben
+                i2c.write(0x02);  // 
+                i2c.write(0xFA);  // schriebn auf Port 0 den INVERSEN Wert von btn; 0xFA = weil die weissen LEds leuchten sollen und FA der bimätcode von den weissen leds ist
+            i2c.stop();
+        
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 984509832f85 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 15 11:48:30 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file