Tea Problem Solver |
We, all family members of the tea drinking age, share a tea problem, that is solved by this tea problem solver. The problem we have (we tend to think that we are not alone with this), is, when we want tea it is not yet made and when it is ready we have our mind set on something else and forget to take the teabag out in time. Getting much too strong stuff in the end. The "Tea Problem Solver" (TPS) ensures that that tea bag is removed from the tea in time, independent of the current mindset of the tea drinker. In addition it provides sugar if instructed by the user. This is the "Tea Brewing Workflow":
Of course there is room for improvement: for example, someone needs to wipe the table after the sugar dropped from much too high into the cup. (Overspill is guaranteed). At the moment though we enjoy perfectly brewed cups of tea. NXC Source Code: #define BEUTEL_HEBER OUT_A #define BEUTEL_HEB_DREHUNGEN 1800 #define KANDIS_KIPPE OUT_B #define KANDIS_KIP_DREHUNGEN 160 #define KLINGEL_LAUSCHER IN_2 #define KLINGEL_GRENZWERT 90 #define BEDIENKNOPF IN_1 #define BEDIENKNOPF_WERT SENSOR_1 sub hebeBeutel() { RotateMotor(BEUTEL_HEBER,40,BEUTEL_HEB_DREHUNGEN); } sub kippeKandis() { RotateMotor(KANDIS_KIPPE,20,KANDIS_KIP_DREHUNGEN); Wait(1000); RotateMotor(KANDIS_KIPPE,20,-KANDIS_KIP_DREHUNGEN); } sub mitZucker() { PlayFile("mitzucker.rso"); Wait(3500); } sub endeMitZucker() { PlayTone(400,400); Wait(400); } sub teeIstFertig() { PlayFile("teeistfertig.rso"); Wait(3000); } task main () { SetSensorSound(KLINGEL_LAUSCHER); SetSensor(BEDIENKNOPF,SENSOR_TOUCH); until(BEDIENKNOPF_WERT==1); mitZucker(); bool mitZucker=false; int i=0; do { Wait(100); i++; int bedien= SENSOR_1; if (bedien==1) { mitZucker=true; } } while (i<50 && ! mitZucker); endeMitZucker(); until(SENSOR_2 > KLINGEL_GRENZWERT); Wait(2000); hebeBeutel(); if (mitZucker) { kippeKandis(); } teeIstFertig(); } |