PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

Committer:
itslinear
Date:
Tue Mar 27 09:39:45 2018 +0000
Revision:
30:44475cc82016
Parent:
24:da1af5214804
Child:
38:5bbf548e6872
various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aeschsim 8:6ece7caefb33 1 #include "functions.h"
aeschsim 8:6ece7caefb33 2
cittecla 11:e8a7a4a9af05 3 void setLED(char button, uint32_t color)
cittecla 11:e8a7a4a9af05 4 {
cittecla 11:e8a7a4a9af05 5 float red = ((color >> 16) & 0xff)/2.55;
cittecla 11:e8a7a4a9af05 6 float green = ((color >> 8) & 0xff)/2.55;
cittecla 11:e8a7a4a9af05 7 float blue = (color & 0xff)/2.55;
aeschsim 24:da1af5214804 8
aeschsim 24:da1af5214804 9 /* PWM channel 9-15, Button is 1 or 2
itslinear 30:44475cc82016 10 * -> if Button = 1, set Channel 10,11,12
itslinear 30:44475cc82016 11 * -> if Button = 2, set Channel 13,14,15
aeschsim 24:da1af5214804 12 */
aeschsim 24:da1af5214804 13
itslinear 30:44475cc82016 14 setPWM(7+(3*button) , red);
itslinear 30:44475cc82016 15 setPWM(7+(3*button)+1 , green);
itslinear 30:44475cc82016 16 setPWM(7+(3*button)+2 , blue);
aeschsim 24:da1af5214804 17
EHess 22:828b393dff51 18 }
itslinear 17:bbafd216e059 19
aeschsim 24:da1af5214804 20
itslinear 17:bbafd216e059 21 void setValvePosition(char pos)
itslinear 17:bbafd216e059 22 {
aeschsim 23:79638b0e9b16 23 switch(pos) {
aeschsim 23:79638b0e9b16 24 case 0: // neutrale Position
aeschsim 23:79638b0e9b16 25 setPWM(0, 50);
aeschsim 23:79638b0e9b16 26 break;
aeschsim 23:79638b0e9b16 27 case 1: // Glas
aeschsim 23:79638b0e9b16 28 setPWM(0, 100);
aeschsim 23:79638b0e9b16 29 break;
aeschsim 23:79638b0e9b16 30 case 2: // Auswurf
aeschsim 23:79638b0e9b16 31 setPWM(0, 0);
aeschsim 23:79638b0e9b16 32 break;
aeschsim 23:79638b0e9b16 33 }
itslinear 17:bbafd216e059 34 }
itslinear 17:bbafd216e059 35
aeschsim 23:79638b0e9b16 36 void setSpeed(char container, char direction)
aeschsim 23:79638b0e9b16 37 {
aeschsim 23:79638b0e9b16 38 }
aeschsim 12:f28a798d2661 39
EHess 22:828b393dff51 40
itslinear 17:bbafd216e059 41 bool controlPosition(char container)
itslinear 17:bbafd216e059 42 {
itslinear 17:bbafd216e059 43 return 0;
itslinear 17:bbafd216e059 44 }
itslinear 17:bbafd216e059 45 int getServoAngle(char container)
itslinear 17:bbafd216e059 46 {
itslinear 17:bbafd216e059 47 return 0;
itslinear 17:bbafd216e059 48 }