// wind vane parameters #define MUX_A D5 #define MUX_B D4 #define MUX_C D3 #define READPIN 0 // Analog input on NodeMcu = A0 #define NO_PINS 8 String SW_VERSION = "Ver. 4.0"; int val[NO_PINS]; // number of ports mux float wind_Direction_Angle = 0; String wind_Direction_Rose; String windRose[16] = {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"}; float windAng[16] = {0,22.5,45,67.5,90,112.5,135,157.5,180,202.5,225,247.5,270,292.5, 315,337.5}; // Direccions Matrix int Digit [16] [NO_PINS] = { {1,0,0,0,0,0,0,0}, {1,1,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0}, {0,1,1,0,0,0,0,0}, {0,0,1,0,0,0,0,0}, {0,0,1,1,0,0,0,0}, {0,0,0,1,0,0,0,0}, {0,0,0,1,1,0,0,0}, {0,0,0,0,1,0,0,0}, {0,0,0,0,1,1,0,0}, {0,0,0,0,0,1,0,0}, {0,0,0,0,0,1,1,0}, {0,0,0,0,0,0,1,0}, {0,0,0,0,0,0,1,1}, {0,0,0,0,0,0,0,1}, {1,0,0,0,0,0,0,1}, }; // ABC mux combinations int muxABC[8] [3] = { {0,0,0}, {0,0,1}, {0,1,0}, {0,1,1}, {1,0,0}, {1,0,1}, {1,1,0}, {1,1,1}, }; // anemometer parameters volatile byte rpmcount; // count signals volatile unsigned long last_micros; unsigned long timeold; unsigned long timemeasure = 25.00; // seconds int timetoSleep = 1; // minutes unsigned long sleepTime = 15; // minutes unsigned long timeNow; int countThing = 0; int GPIO_pulse = 12; // NodeMCU = D6 float rpm, rps; // frequencies float radius = 0.088; // meters - measure of the lenght of each the anemometer wing float linear_velocity = 0; // m/seg float linear_velocity_kmh; // km/h float omega = 0; // rad/seg