You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// For scope, instantiate all objects you will need to access in loop()
// It may be just one Fuzzy, but for demonstration, this sample will print
// all FuzzySet pertinence
// Fuzzy
Fuzzy *fuzzy = new Fuzzy();
// FuzzyInputHB
FuzzySet *veryslow = new FuzzySet(60, 70, 70, 80);
FuzzySet *slow = new FuzzySet(75, 80, 80, 90);
FuzzySet *fast = new FuzzySet(85 ,90, 90, 100);
FuzzySet *veryfast = new FuzzySet(95, 100, 100, 110);
// FuzzyInputTemp
FuzzySet *verycold = new FuzzySet(31, 32, 32, 33);
FuzzySet *cold = new FuzzySet(33,34 , 34, 35);
FuzzySet *hot = new FuzzySet(35, 36, 36, 37);
FuzzySet *veryhot = new FuzzySet(37, 38 , 38, 39);
`#include <Fuzzy.h>
// For scope, instantiate all objects you will need to access in loop()
// It may be just one Fuzzy, but for demonstration, this sample will print
// all FuzzySet pertinence
// Fuzzy
Fuzzy *fuzzy = new Fuzzy();
// FuzzyInputHB
FuzzySet *veryslow = new FuzzySet(60, 70, 70, 80);
FuzzySet *slow = new FuzzySet(75, 80, 80, 90);
FuzzySet *fast = new FuzzySet(85 ,90, 90, 100);
FuzzySet *veryfast = new FuzzySet(95, 100, 100, 110);
// FuzzyInputTemp
FuzzySet *verycold = new FuzzySet(31, 32, 32, 33);
FuzzySet *cold = new FuzzySet(33,34 , 34, 35);
FuzzySet *hot = new FuzzySet(35, 36, 36, 37);
FuzzySet *veryhot = new FuzzySet(37, 38 , 38, 39);
// FuzzyInputGSR
FuzzySet *verydry= new FuzzySet(0 , 1 , 1 , 2);
FuzzySet *dry = new FuzzySet(1 , 2 , 2, 3);
FuzzySet *moist = new FuzzySet(2 , 3, 3, 4);
FuzzySet *verymoist = new FuzzySet(4 , 5 ,6 , 7);
// Fuzzyoutput
FuzzySet *relax= new FuzzySet(0 , 12.5 , 12.5 , 25);
FuzzySet *tenang = new FuzzySet(25, 37.5, 37.5, 50);
FuzzySet *cemas = new FuzzySet(50, 62.5, 62.5 , 75);
FuzzySet *stress = new FuzzySet(75, 87.5 , 87.5, 100);
void setup()
{
// Set the Serial output
Serial.begin(9600);
// Set a random seed
randomSeed(analogRead(0));
// Every setup must occur in the function setup()
// FuzzyInput
FuzzyInput *Hb = new FuzzyInput(1);
Hb->addFuzzySet(veryslow);
Hb->addFuzzySet(slow);
Hb->addFuzzySet(fast);
Hb->addFuzzySet(veryfast);
fuzzy->addFuzzyInput(Hb);
// FuzzyInput
FuzzyInput *Temp = new FuzzyInput(2);
Temp->addFuzzySet(verycold);
Temp->addFuzzySet(cold);
Temp->addFuzzySet(hot);
Temp->addFuzzySet(veryhot);
fuzzy->addFuzzyInput(Temp);
// FuzzyInput
FuzzyInput *Gsr = new FuzzyInput(3);
Gsr->addFuzzySet(verydry);
Gsr->addFuzzySet(dry);
Gsr->addFuzzySet(moist);
Gsr->addFuzzySet(verymoist);
fuzzy->addFuzzyInput(Gsr);
// FuzzyOutput
FuzzyOutput *Condition = new FuzzyOutput(1);
Condition->addFuzzySet(relax);
Condition->addFuzzySet(tenang);
Condition->addFuzzySet(cemas);
Condition->addFuzzySet(stress);
fuzzy->addFuzzyOutput(Condition);
// Building FuzzyRule
FuzzyRuleAntecedent *HbveryslowAndTempveryhot = new FuzzyRuleAntecedent();
HbveryslowAndTempveryhot->joinWithAND(veryslow, veryhot);
FuzzyRuleAntecedent *IfHbveryslowAndTempveryhotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempveryhotAndGsrverydry->joinWithAND(HbveryslowAndTempveryhot, verydry);
FuzzyRuleConsequent *thenConditionrelax = new FuzzyRuleConsequent();
thenConditionrelax->addOutput(relax);
FuzzyRule *fuzzyRule1 = new FuzzyRule(1, IfHbveryslowAndTempveryhotAndGsrverydry, thenConditionrelax);
fuzzy->addFuzzyRule(fuzzyRule1);
// Building FuzzyRule 2
FuzzyRuleAntecedent *HbveryslowAndTemphot = new FuzzyRuleAntecedent();
HbveryslowAndTemphot->joinWithAND(veryslow, hot);
FuzzyRuleAntecedent *IfHbveryslowAndTemphotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryslowAndTemphotAndGsrverydry->joinWithAND(HbveryslowAndTemphot, verydry);
FuzzyRule *fuzzyRule2 = new FuzzyRule(2, IfHbveryslowAndTemphotAndGsrverydry, thenConditionrelax);
fuzzy->addFuzzyRule(fuzzyRule2);
// Building FuzzyRule 3
FuzzyRuleAntecedent *HbveryslowAndTempcold = new FuzzyRuleAntecedent();
HbveryslowAndTempcold->joinWithAND(veryslow, cold);
FuzzyRuleAntecedent *IfHbveryslowAndTempcoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempcoldAndGsrverydry->joinWithAND(HbveryslowAndTempcold, verydry);
FuzzyRuleConsequent *thenConditiontenang = new FuzzyRuleConsequent();
thenConditionrelax->addOutput(tenang);
FuzzyRule *fuzzyRule3 = new FuzzyRule(3, IfHbveryslowAndTempcoldAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule3);
// Building FuzzyRule 4
FuzzyRuleAntecedent *HbveryslowAndTempverycold = new FuzzyRuleAntecedent();
HbveryslowAndTempverycold->joinWithAND(veryslow, verycold);
FuzzyRuleAntecedent *IfHbveryslowAndTempverycoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempverycoldAndGsrverydry->joinWithAND(HbveryslowAndTempverycold, verydry);
FuzzyRuleConsequent *thenConditioncemas = new FuzzyRuleConsequent();
thenConditioncemas->addOutput(cemas);
FuzzyRule *fuzzyRule4 = new FuzzyRule(4, IfHbveryslowAndTempverycoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule4);
// Building FuzzyRule 5
FuzzyRuleAntecedent *HbslowAndTempveryhot = new FuzzyRuleAntecedent();
HbslowAndTempveryhot->joinWithAND(slow, veryhot);
FuzzyRuleAntecedent *IfHbslowAndTempveryhotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbslowAndTempveryhotAndGsrverydry->joinWithAND(HbslowAndTempveryhot, verydry);
FuzzyRule *fuzzyRule5 = new FuzzyRule(5, IfHbslowAndTempveryhotAndGsrverydry, thenConditionrelax);
fuzzy->addFuzzyRule(fuzzyRule5);
// Building FuzzyRule 6
FuzzyRuleAntecedent *HbslowAndTemphot = new FuzzyRuleAntecedent();
HbslowAndTemphot->joinWithAND(slow, hot);
FuzzyRuleAntecedent *IfHbslowAndTemphotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbslowAndTemphotAndGsrverydry->joinWithAND(HbslowAndTemphot, verydry);
FuzzyRule *fuzzyRule6 = new FuzzyRule(6, IfHbslowAndTemphotAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule6);
// Building FuzzyRule 7
FuzzyRuleAntecedent *HbslowAndTempcold = new FuzzyRuleAntecedent();
HbslowAndTempcold->joinWithAND(slow, cold);
FuzzyRuleAntecedent *IfHbslowAndTempcoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbslowAndTempcoldAndGsrverydry->joinWithAND(HbslowAndTempcold, verydry);
FuzzyRule *fuzzyRule7 = new FuzzyRule(7, IfHbslowAndTempcoldAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule7);
// Building FuzzyRule 8
FuzzyRuleAntecedent *HbslowAndTempverycold = new FuzzyRuleAntecedent();
HbslowAndTempverycold->joinWithAND(slow, verycold);
FuzzyRuleAntecedent *IfHbslowAndTempverycoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbslowAndTempcoldAndGsrverydry->joinWithAND(HbslowAndTempverycold, verydry);
FuzzyRule *fuzzyRule8 = new FuzzyRule(8, IfHbslowAndTempcoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule8);
// Building FuzzyRule 9
FuzzyRuleAntecedent *HbfastAndTempveryhot = new FuzzyRuleAntecedent();
HbfastAndTempveryhot->joinWithAND(fast, veryhot);
FuzzyRuleAntecedent *IfHbfastAndTempveryhotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbfastAndTempveryhotAndGsrverydry->joinWithAND(HbfastAndTempveryhot, verydry);
FuzzyRule *fuzzyRule9 = new FuzzyRule(9, IfHbfastAndTempveryhotAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule9);
// Building FuzzyRule 10
FuzzyRuleAntecedent *HbfastAndTemphot = new FuzzyRuleAntecedent();
HbfastAndTemphot->joinWithAND(fast, hot);
FuzzyRuleAntecedent *IfHbfastAndTemphotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbfastAndTemphotAndGsrverydry->joinWithAND(HbfastAndTemphot, verydry);
FuzzyRule *fuzzyRule10 = new FuzzyRule(10, IfHbfastAndTemphotAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule10);
// Building FuzzyRule 11
FuzzyRuleAntecedent *HbfastAndTempcold = new FuzzyRuleAntecedent();
HbfastAndTempcold->joinWithAND(fast, cold);
FuzzyRuleAntecedent *IfHbfastAndTempcoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbfastAndTempcoldAndGsrverydry->joinWithAND(HbfastAndTempcold, verydry);
FuzzyRule *fuzzyRule11 = new FuzzyRule(11, IfHbfastAndTempcoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule11);
FuzzyRuleAntecedent *HbfastAndTempverycold = new FuzzyRuleAntecedent();
HbfastAndTempverycold->joinWithAND(fast, verycold);
FuzzyRuleAntecedent *IfHbfastAndTempverycoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbfastAndTempverycoldAndGsrverydry->joinWithAND(HbfastAndTempverycold, verydry);
FuzzyRule *fuzzyRule12 = new FuzzyRule(12, IfHbfastAndTempverycoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule12);
FuzzyRuleAntecedent *HbveryfastAndTempveryhot = new FuzzyRuleAntecedent();
HbveryfastAndTempveryhot->joinWithAND(veryfast, veryhot);
FuzzyRuleAntecedent *IfHbveryfastAndTempveryhotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempveryhotAndGsrverydry->joinWithAND(HbveryfastAndTempveryhot, verydry);
FuzzyRule *fuzzyRule13 = new FuzzyRule(13, IfHbveryfastAndTempveryhotAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule13);
FuzzyRuleAntecedent *HbveryfastAndTemphot = new FuzzyRuleAntecedent();
HbveryfastAndTemphot->joinWithAND(veryfast, hot);
FuzzyRuleAntecedent *IfHbveryfastAndTemphotAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryfastAndTemphotAndGsrverydry->joinWithAND(HbveryfastAndTemphot, verydry);
FuzzyRule *fuzzyRule14 = new FuzzyRule(14, IfHbveryfastAndTemphotAndGsrverydry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule14);
FuzzyRuleAntecedent *HbveryfastAndTempcold = new FuzzyRuleAntecedent();
HbveryfastAndTempcold->joinWithAND(veryfast, cold);
FuzzyRuleAntecedent *IfHbveryfastAndTempcoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempcoldAndGsrverydry->joinWithAND(HbveryfastAndTempcold, verydry);
FuzzyRule *fuzzyRule15 = new FuzzyRule(15, IfHbveryfastAndTempcoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule15);
FuzzyRuleAntecedent *HbveryfastAndTempverycold = new FuzzyRuleAntecedent();
HbveryfastAndTempverycold->joinWithAND(veryfast, verycold);
FuzzyRuleAntecedent *IfHbveryfastAndTempverycoldAndGsrverydry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempverycoldAndGsrverydry->joinWithAND(HbveryfastAndTempverycold, verydry);
FuzzyRule *fuzzyRule16 = new FuzzyRule(16, IfHbveryfastAndTempverycoldAndGsrverydry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule16);
// Building FuzzyRule 17
HbveryslowAndTempveryhot->joinWithAND(veryslow, veryhot);
FuzzyRuleAntecedent *IfHbveryslowAndTempveryhotAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempveryhotAndGsrdry->joinWithAND(HbveryslowAndTempveryhot, dry);
FuzzyRule *fuzzyRule17 = new FuzzyRule(17, IfHbveryslowAndTempveryhotAndGsrdry, thenConditionrelax);
fuzzy->addFuzzyRule(fuzzyRule17);
// Building FuzzyRule 18
HbveryslowAndTemphot->joinWithAND(veryslow, hot);
FuzzyRuleAntecedent *IfHbveryslowAndTemphotAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryslowAndTemphotAndGsrdry->joinWithAND(HbveryslowAndTemphot, dry);
FuzzyRule *fuzzyRule18 = new FuzzyRule(18, IfHbveryslowAndTemphotAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule18);
// Building FuzzyRule 19
HbveryslowAndTempcold->joinWithAND(veryslow, cold);
FuzzyRuleAntecedent *IfHbveryslowAndTempcoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempcoldAndGsrdry->joinWithAND(HbveryslowAndTempcold, dry);
FuzzyRule *fuzzyRule19 = new FuzzyRule(19, IfHbveryslowAndTempcoldAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule19);
// Building FuzzyRule 20
HbveryslowAndTempverycold->joinWithAND(veryslow, verycold);
FuzzyRuleAntecedent *IfHbveryslowAndTempverycoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryslowAndTempverycoldAndGsrdry->joinWithAND(HbveryslowAndTempverycold, dry);
FuzzyRule *fuzzyRule20 = new FuzzyRule(20, IfHbveryslowAndTempverycoldAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule20);
// Building FuzzyRule 21
HbslowAndTempveryhot->joinWithAND(slow, veryhot);
FuzzyRuleAntecedent *IfHbslowAndTempveryhotAndGsrdry = new FuzzyRuleAntecedent();
IfHbslowAndTempveryhotAndGsrdry->joinWithAND(HbslowAndTempveryhot, dry);
FuzzyRule *fuzzyRule21 = new FuzzyRule(21, IfHbslowAndTempveryhotAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule21);
// Building FuzzyRule 22
HbslowAndTemphot->joinWithAND(slow, hot);
FuzzyRuleAntecedent *IfHbslowAndTemphotAndGsrdry = new FuzzyRuleAntecedent();
IfHbslowAndTemphotAndGsrdry->joinWithAND(HbslowAndTemphot, dry);
FuzzyRule *fuzzyRule22 = new FuzzyRule(22, IfHbslowAndTemphotAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule22);
// Building FuzzyRule 23
HbslowAndTempcold->joinWithAND(slow, cold);
FuzzyRuleAntecedent *IfHbslowAndTempcoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbslowAndTempcoldAndGsrdry->joinWithAND(HbslowAndTempcold, dry);
FuzzyRule *fuzzyRule23 = new FuzzyRule(23, IfHbslowAndTempcoldAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule23);
// Building FuzzyRule 24
HbslowAndTempverycold->joinWithAND(slow, verycold);
FuzzyRuleAntecedent *IfHbslowAndTempverycoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbslowAndTempverycoldAndGsrdry->joinWithAND(HbslowAndTempverycold, dry);
FuzzyRule *fuzzyRule24 = new FuzzyRule(24, IfHbslowAndTempverycoldAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule24);
// Building FuzzyRule 25
HbfastAndTempveryhot->joinWithAND(fast, veryhot);
FuzzyRuleAntecedent *IfHbfastAndTempveryhotAndGsrdry = new FuzzyRuleAntecedent();
IfHbfastAndTempveryhotAndGsrdry->joinWithAND(HbfastAndTempveryhot, dry);
FuzzyRule *fuzzyRule25 = new FuzzyRule(25, IfHbfastAndTempveryhotAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule25);
// Building FuzzyRule 26
HbfastAndTemphot->joinWithAND(fast, hot);
FuzzyRuleAntecedent *IfHbfastAndTemphotAndGsrdry = new FuzzyRuleAntecedent();
IfHbfastAndTemphotAndGsrdry->joinWithAND(HbfastAndTemphot, dry);
FuzzyRule *fuzzyRule26 = new FuzzyRule(26, IfHbfastAndTemphotAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule26);
// Building FuzzyRule 27
HbfastAndTempcold->joinWithAND(fast, cold);
FuzzyRuleAntecedent *IfHbfastAndTempcoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbfastAndTempcoldAndGsrdry->joinWithAND(HbfastAndTempcold, dry);
FuzzyRule *fuzzyRule27 = new FuzzyRule(27, IfHbfastAndTempcoldAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule27);
HbfastAndTempverycold->joinWithAND(fast, verycold);
FuzzyRuleAntecedent *IfHbfastAndTempverycoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbfastAndTempverycoldAndGsrdry->joinWithAND(HbfastAndTempverycold, dry);
FuzzyRule *fuzzyRule28 = new FuzzyRule(28, IfHbfastAndTempverycoldAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule28);
HbveryfastAndTempveryhot->joinWithAND(veryfast, veryhot);
FuzzyRuleAntecedent *IfHbveryfastAndTempveryhotAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempveryhotAndGsrdry->joinWithAND(HbveryfastAndTempveryhot, dry);
FuzzyRule *fuzzyRule29 = new FuzzyRule(29, IfHbveryfastAndTempveryhotAndGsrdry, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule29);
HbveryfastAndTemphot->joinWithAND(veryfast, hot);
FuzzyRuleAntecedent *IfHbveryfastAndTemphotAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryfastAndTemphotAndGsrdry->joinWithAND(HbveryfastAndTemphot, dry);
FuzzyRule *fuzzyRule30 = new FuzzyRule(30, IfHbveryfastAndTemphotAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule30);
HbveryfastAndTempcold->joinWithAND(veryfast, cold);
FuzzyRuleAntecedent *IfHbveryfastAndTempcoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempcoldAndGsrdry->joinWithAND(HbveryfastAndTempcold, dry);
FuzzyRule *fuzzyRule31 = new FuzzyRule(31, IfHbveryfastAndTempcoldAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule31);
HbveryfastAndTempverycold->joinWithAND(veryfast, verycold);
FuzzyRuleAntecedent *IfHbveryfastAndTempverycoldAndGsrdry = new FuzzyRuleAntecedent();
IfHbveryfastAndTempverycoldAndGsrdry->joinWithAND(HbveryfastAndTempverycold, dry);
FuzzyRule *fuzzyRule32 = new FuzzyRule(32, IfHbveryfastAndTempverycoldAndGsrdry, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule32);
// Building FuzzyRule 33
HbveryslowAndTempveryhot->joinWithAND(veryslow, veryhot);
FuzzyRuleAntecedent *IfHbveryslowAndTempveryhotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempveryhotAndGsrmoist->joinWithAND(HbveryslowAndTempveryhot, moist);
FuzzyRule *fuzzyRule33 = new FuzzyRule(33, IfHbveryslowAndTempveryhotAndGsrmoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule33);
// Building FuzzyRule 34
HbveryslowAndTemphot->joinWithAND(veryslow, hot);
FuzzyRuleAntecedent *IfHbveryslowAndTemphotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTemphotAndGsrmoist->joinWithAND(HbveryslowAndTemphot, moist);
FuzzyRule *fuzzyRule34 = new FuzzyRule(34, IfHbveryslowAndTemphotAndGsrmoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule34);
// Building FuzzyRule 35
HbveryslowAndTempcold->joinWithAND(veryslow, cold);
FuzzyRuleAntecedent *IfHbveryslowAndTempcoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempcoldAndGsrmoist->joinWithAND(HbveryslowAndTempcold, moist);
FuzzyRule *fuzzyRule35 = new FuzzyRule(35, IfHbveryslowAndTempcoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule35);
// Building FuzzyRule 36
HbveryslowAndTempverycold->joinWithAND(veryslow, verycold);
FuzzyRuleAntecedent *IfHbveryslowAndTempverycoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempverycoldAndGsrmoist->joinWithAND(HbveryslowAndTempverycold, moist);
FuzzyRule *fuzzyRule36 = new FuzzyRule(36, IfHbveryslowAndTempverycoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule36);
// Building FuzzyRule 37
HbslowAndTempveryhot->joinWithAND(slow, veryhot);
FuzzyRuleAntecedent *IfHbslowAndTempveryhotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbslowAndTempveryhotAndGsrmoist->joinWithAND(HbslowAndTempveryhot, moist);
FuzzyRule *fuzzyRule37 = new FuzzyRule(37, IfHbslowAndTempveryhotAndGsrmoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule37);
// Building FuzzyRule 38
HbslowAndTemphot->joinWithAND(slow, hot);
FuzzyRuleAntecedent *IfHbslowAndTemphotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbslowAndTemphotAndGsrmoist->joinWithAND(HbslowAndTemphot, moist);
FuzzyRule *fuzzyRule38 = new FuzzyRule(38, IfHbslowAndTemphotAndGsrmoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule38);
// Building FuzzyRule 39
HbslowAndTempcold->joinWithAND(slow, cold);
FuzzyRuleAntecedent *IfHbslowAndTempcoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbslowAndTempcoldAndGsrmoist->joinWithAND(HbslowAndTempcold, moist);
FuzzyRule *fuzzyRule39 = new FuzzyRule(39, IfHbslowAndTempcoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule39);
// Building FuzzyRule 40
HbslowAndTempverycold->joinWithAND(slow, verycold);
FuzzyRuleAntecedent *IfHbslowAndTempverycoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbslowAndTempverycoldAndGsrmoist->joinWithAND(HbslowAndTempverycold, moist);
FuzzyRule *fuzzyRule40 = new FuzzyRule(40, IfHbslowAndTempverycoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule40);
// Building FuzzyRule 41
HbfastAndTempveryhot->joinWithAND(fast, veryhot);
FuzzyRuleAntecedent *IfHbfastAndTempveryhotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbfastAndTempveryhotAndGsrmoist->joinWithAND(HbfastAndTempveryhot, moist);
FuzzyRule *fuzzyRule41 = new FuzzyRule(41, IfHbfastAndTempveryhotAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule41);
// Building FuzzyRule 42
HbfastAndTemphot->joinWithAND(fast, hot);
FuzzyRuleAntecedent *IfHbfastAndTemphotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbfastAndTemphotAndGsrmoist->joinWithAND(HbfastAndTemphot, moist);
FuzzyRule *fuzzyRule42 = new FuzzyRule(42, IfHbfastAndTemphotAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule42);
// Building FuzzyRule 43
HbfastAndTempcold->joinWithAND(fast, cold);
FuzzyRuleAntecedent *IfHbfastAndTempcoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbfastAndTempcoldAndGsrmoist->joinWithAND(HbfastAndTempcold, moist);
FuzzyRule *fuzzyRule43 = new FuzzyRule(43, IfHbfastAndTempcoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule43);
HbfastAndTempverycold->joinWithAND(fast, verycold);
FuzzyRuleAntecedent *IfHbfastAndTempverycoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbfastAndTempverycoldAndGsrmoist->joinWithAND(HbfastAndTempverycold, moist);
FuzzyRule *fuzzyRule44 = new FuzzyRule(44, IfHbfastAndTempverycoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule44);
HbveryfastAndTempveryhot->joinWithAND(veryfast, veryhot);
FuzzyRuleAntecedent *IfHbveryfastAndTempveryhotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempveryhotAndGsrmoist->joinWithAND(HbveryfastAndTempveryhot, moist);
FuzzyRule *fuzzyRule45 = new FuzzyRule(45, IfHbveryfastAndTempveryhotAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule45);
HbveryfastAndTemphot->joinWithAND(veryfast, hot);
FuzzyRuleAntecedent *IfHbveryfastAndTemphotAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTemphotAndGsrmoist->joinWithAND(HbveryfastAndTemphot, moist);
FuzzyRule *fuzzyRule46 = new FuzzyRule(46, IfHbveryfastAndTemphotAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule46);
HbveryfastAndTempcold->joinWithAND(veryfast, cold);
FuzzyRuleAntecedent *IfHbveryfastAndTempcoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempcoldAndGsrmoist->joinWithAND(HbveryfastAndTempcold, moist);
FuzzyRule *fuzzyRule47 = new FuzzyRule(47, IfHbveryfastAndTempcoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule47);
HbveryfastAndTempverycold->joinWithAND(veryfast, verycold);
FuzzyRuleAntecedent *IfHbveryfastAndTempverycoldAndGsrmoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempverycoldAndGsrmoist->joinWithAND(HbveryfastAndTempverycold, moist);
FuzzyRule *fuzzyRule48 = new FuzzyRule(48, IfHbveryfastAndTempverycoldAndGsrmoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule48);
// Building FuzzyRule 49
HbveryslowAndTempveryhot->joinWithAND(veryslow, veryhot);
FuzzyRuleAntecedent *IfHbveryslowAndTempveryhotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempveryhotAndGsrverymoist->joinWithAND(HbveryslowAndTempveryhot, verymoist);
FuzzyRule *fuzzyRule49 = new FuzzyRule(49, IfHbveryslowAndTempveryhotAndGsrverymoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule49);
// Building FuzzyRule 50
HbveryslowAndTemphot->joinWithAND(veryslow, hot);
FuzzyRuleAntecedent *IfHbveryslowAndTemphotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTemphotAndGsrverymoist->joinWithAND(HbveryslowAndTemphot, verymoist);
FuzzyRule *fuzzyRule50 = new FuzzyRule(50, IfHbveryslowAndTemphotAndGsrverymoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule50);
// Building FuzzyRule 51
HbveryslowAndTempcold->joinWithAND(veryslow, cold);
FuzzyRuleAntecedent *IfHbveryslowAndTempcoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempcoldAndGsrverymoist->joinWithAND(HbveryslowAndTempcold, verymoist);
FuzzyRule *fuzzyRule51 = new FuzzyRule(51, IfHbveryslowAndTempcoldAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule51);
// Building FuzzyRule 52
HbveryslowAndTempverycold->joinWithAND(veryslow, verycold);
FuzzyRuleAntecedent *IfHbveryslowAndTempverycoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryslowAndTempverycoldAndGsrverymoist->joinWithAND(HbveryslowAndTempverycold, verymoist);
FuzzyRule *fuzzyRule52 = new FuzzyRule(52, IfHbveryslowAndTempverycoldAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule52);
// Building FuzzyRule 53
HbslowAndTempveryhot->joinWithAND(slow, veryhot);
FuzzyRuleAntecedent *IfHbslowAndTempveryhotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbslowAndTempveryhotAndGsrverymoist->joinWithAND(HbslowAndTempveryhot, verymoist);
FuzzyRule *fuzzyRule53 = new FuzzyRule(53, IfHbslowAndTempveryhotAndGsrverymoist, thenConditiontenang);
fuzzy->addFuzzyRule(fuzzyRule53);
// Building FuzzyRule 54
HbslowAndTemphot->joinWithAND(slow, hot);
FuzzyRuleAntecedent *IfHbslowAndTemphotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbslowAndTemphotAndGsrverymoist->joinWithAND(HbslowAndTemphot, verymoist);
FuzzyRule *fuzzyRule54 = new FuzzyRule(54, IfHbslowAndTemphotAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule54);
// Building FuzzyRule 55
HbslowAndTempcold->joinWithAND(slow, cold);
FuzzyRuleAntecedent *IfHbslowAndTempcoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbslowAndTempcoldAndGsrverymoist->joinWithAND(HbslowAndTempcold, verymoist);
FuzzyRule *fuzzyRule55 = new FuzzyRule(55, IfHbslowAndTempcoldAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule55);
// Building FuzzyRule 56
HbslowAndTempverycold->joinWithAND(slow, verycold);
FuzzyRuleAntecedent *IfHbslowAndTempverycoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbslowAndTempverycoldAndGsrverymoist->joinWithAND(HbslowAndTempverycold, verymoist);
FuzzyRule *fuzzyRule56 = new FuzzyRule(56, IfHbslowAndTempverycoldAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule56);
// Building FuzzyRule 57
HbfastAndTempveryhot->joinWithAND(fast, veryhot);
FuzzyRuleAntecedent *IfHbfastAndTempveryhotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbfastAndTempveryhotAndGsrverymoist->joinWithAND(HbfastAndTempveryhot, verymoist);
FuzzyRule *fuzzyRule57 = new FuzzyRule(57, IfHbfastAndTempveryhotAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule57);
// Building FuzzyRule 58
HbfastAndTemphot->joinWithAND(fast, hot);
FuzzyRuleAntecedent *IfHbfastAndTemphotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbfastAndTemphotAndGsrverymoist->joinWithAND(HbfastAndTemphot, verymoist);
FuzzyRule *fuzzyRule58 = new FuzzyRule(58, IfHbfastAndTemphotAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule58);
// Building FuzzyRule 59
HbfastAndTempcold->joinWithAND(fast, cold);
FuzzyRuleAntecedent *IfHbfastAndTempcoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbfastAndTempcoldAndGsrverymoist->joinWithAND(HbfastAndTempcold, verymoist);
FuzzyRule *fuzzyRule59 = new FuzzyRule(59, IfHbfastAndTempcoldAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule59);
HbfastAndTempverycold->joinWithAND(fast, verycold);
FuzzyRuleAntecedent *IfHbfastAndTempverycoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbfastAndTempverycoldAndGsrverymoist->joinWithAND(HbfastAndTempverycold, verymoist);
FuzzyRuleConsequent *thenConditionstress = new FuzzyRuleConsequent();
thenConditionstress->addOutput(stress);
FuzzyRule *fuzzyRule60 = new FuzzyRule(60, IfHbfastAndTempverycoldAndGsrverymoist, thenConditionstress);
fuzzy->addFuzzyRule(fuzzyRule60);
HbveryfastAndTempveryhot->joinWithAND(veryfast, veryhot);
FuzzyRuleAntecedent *IfHbveryfastAndTempveryhotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempveryhotAndGsrverymoist->joinWithAND(HbveryfastAndTempveryhot, verymoist);
FuzzyRule *fuzzyRule61 = new FuzzyRule(61, IfHbveryfastAndTempveryhotAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule61);
HbveryfastAndTemphot->joinWithAND(veryfast, hot);
FuzzyRuleAntecedent *IfHbveryfastAndTemphotAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTemphotAndGsrverymoist->joinWithAND(HbveryfastAndTemphot, verymoist);
FuzzyRule *fuzzyRule62 = new FuzzyRule(62, IfHbveryfastAndTemphotAndGsrverymoist, thenConditioncemas);
fuzzy->addFuzzyRule(fuzzyRule62);
HbveryfastAndTempcold->joinWithAND(veryfast, cold);
FuzzyRuleAntecedent *IfHbveryfastAndTempcoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempcoldAndGsrverymoist->joinWithAND(HbveryfastAndTempcold, verymoist);
FuzzyRule *fuzzyRule63 = new FuzzyRule(63, IfHbveryfastAndTempcoldAndGsrverymoist, thenConditionstress);
fuzzy->addFuzzyRule(fuzzyRule63);
HbveryfastAndTempverycold->joinWithAND(veryfast, verycold);
FuzzyRuleAntecedent *IfHbveryfastAndTempverycoldAndGsrverymoist = new FuzzyRuleAntecedent();
IfHbveryfastAndTempverycoldAndGsrverymoist->joinWithAND(HbveryfastAndTempverycold, verymoist);
FuzzyRule *fuzzyRule64 = new FuzzyRule(64, IfHbveryfastAndTempverycoldAndGsrverymoist, thenConditionstress);
fuzzy->addFuzzyRule(fuzzyRule64);
}
void loop()
{
// get random entrances
int input1 = random(60, 110);
int input2 = random(32, 37);
int input3 = random(1, 7);
Serial.println("\n\n\nEntrance: ");
Serial.print("\t\t\denyut jantung: ");
Serial.print(input1);
Serial.print(", suhu tubuh: ");
Serial.print(input2);
Serial.print(", and kelembaban: ");
Serial.println(input3);
fuzzy->setInput(1, input1);
fuzzy->setInput(2, input2);
fuzzy->setInput(3, input3);
fuzzy->fuzzify();
Serial.println("Input: ");
Serial.print("\tHb: veryslow-> ");
Serial.print(veryslow->getPertinence());
Serial.print("\tHb: slow-> ");
Serial.print(slow->getPertinence());
Serial.print("\tHb: fast-> ");
Serial.print(fast->getPertinence());
Serial.print("\tHb: veryfast-> ");
Serial.print(veryfast->getPertinence());
Serial.println("Input2: ");
Serial.print("\tTemp: veryhot-> ");
Serial.print(veryhot->getPertinence());
Serial.print("\tTemp: hot-> ");
Serial.print(hot->getPertinence());
Serial.print("\tTemp: cold-> ");
Serial.print(cold->getPertinence());
Serial.print("\tTemp: verycold-> ");
Serial.print(verycold->getPertinence());
Serial.println("Input3: ");
Serial.print("\tGsr: verydry-> ");
Serial.print(verydry->getPertinence());
Serial.print("\tGsr: dry-> ");
Serial.print(dry->getPertinence());
Serial.print("\tGsr: moist-> ");
Serial.print(moist->getPertinence());
Serial.print("\tGsr: verymoist-> ");
Serial.print(verymoist->getPertinence());
float output1 = fuzzy->defuzzify(1);
Serial.println("Output: ");
Serial.print("\tKondisi Relax-> ");
Serial.print(relax->getPertinence());
Serial.print(",Kondisi Tenang-> ");
Serial.print(tenang->getPertinence());
Serial.print(", Kondisi Cemas-> ");
Serial.println(cemas->getPertinence());
Serial.print(", Kondisi Stress-> ");
Serial.println(stress->getPertinence());
Serial.println (output1);
// wait 12 seconds
delay(12000);
}`
The text was updated successfully, but these errors were encountered: