Fuzzy Logic on Arduino

Hi Friends
I’m creating a river status detection project using the fuzzy logic algorithm. But I’m having problems especially in step defuzzification. The displayed result (PWM/FIS) does not conform to the fuzzy rules set. Who can help me? Thanks

program_mega.ino (26.1 KB)

Who can help me?

Not me. I can't make sense of your post with all that code. Create a SIMPLE program that illustrates the problem.