PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Files at this revision

API Documentation at this revision

Comitter:
aeschsim
Date:
Tue Mar 27 05:07:50 2018 +0000
Parent:
23:79638b0e9b16
Child:
25:8de2b7dd171f
Commit message:
fixed setLED function, added some comments, added pin-out list in main.h

Changed in this revision

header/main.h Show annotated file Show diff for this revision Revisions of this file
source/functions.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/header/main.h	Tue Mar 27 04:54:57 2018 +0000
+++ b/header/main.h	Tue Mar 27 05:07:50 2018 +0000
@@ -6,4 +6,15 @@
 
 /* Achtung! I2C für Servoboard ist auf PIN PB_9, PB_8
 * dies muss in pwmBoard.c geändert werden!
+*
+*   Pin Out:
+*   I2C PB_9, PB_8
+*   Output enable PC_9
+*
+*   Servoboard:
+*   0       Klappe
+*   1-6     Container
+*   9-11    Rot, Grün, Blau Button 1
+*   12-14   Rot, Grün, Blau Button 2
+*
 */
--- a/source/functions.cpp	Tue Mar 27 04:54:57 2018 +0000
+++ b/source/functions.cpp	Tue Mar 27 05:07:50 2018 +0000
@@ -5,8 +5,19 @@
     float red =     ((color >> 16) & 0xff)/2.55;
     float green =   ((color >> 8) & 0xff)/2.55;
     float blue =    (color & 0xff)/2.55;
+    
+    /* PWM channel 9-15, Button is 1 or 2 
+    * -> if Button = 1, set Channel 9,10,11
+    * -> if Button = 2, set Channel 12,13,14
+    */
+    
+    setPWM(6+(3*button) , red);
+    setPWM(6+(3*button)+1 , green);
+    setPWM(6+(3*button)+2 , blue);
+
 }
 
+
 void setValvePosition(char pos)
 {
     switch(pos) {
@@ -24,8 +35,6 @@
 
 void setSpeed(char container, char direction)
 {
-    //nur zum kompilieren!!
-    //setPWM(container,direction);
 }