// Definisi konstanta #define windPin 14 // Receive the data from sensor
const float pi = 3.14159265; // pi number
int period = 10000; // Periode pengukuran (milidetik)
int delaytime = 10000; // Waktu antar sampel (milidetik)
int radio = 90; // Jarak dari pusat kincir angin ke cangkir luar (mm)
int jml_celah = 18; // jumlah celah sensor
// Variable definitions
unsigned int Sample = 0; // Sample number
unsigned int counter = 0; // B/W counter for sensor
unsigned int RPM = 0; // Revolutions per minute
float speedwind = 0; // Wind speed (m/s)
void setup()
{
// Set the pins
pinMode(14, INPUT);
digitalWrite(14, HIGH);
// sets the serial port to 9600
Serial.begin(9600);
// Splash screen
Serial.println("ANEMOMETER");
Serial.println("**********");
Serial.println("Based on depoinovasi anemometer sensor");
Serial.print("Sampling period: ");
Serial.print(period/1000);
Serial.print(" seconds every ");
Serial.print(delaytime/1000);
Serial.println(" seconds.");
Serial.println("** You could modify those values on code **");
Serial.println();
}
Please edit your post and add the code tags. Without them, your post is breaking forum rules. Read the forum guide to find out how. The forum guide is linked to in a sticky post at the top of each forum section.
Which pin of the NodeMCU/Wemos is the anemometer connected to? Confusingly, there are two ways of referring to a pin on these boards, and "2" is not the same pin as "D2"!
attachInterrupt(0, addcount, CHANGE);
On Nano/Uno, interrupt 0 is actually pin 2. Another confusing way to refer to a pin! On NodeMCU/Wemos, you should use the actual pin number, for example "D2".
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project.
NodeMCU is ok with the D-numbering or the GPIO numbering.
WeMos only works with the GPIO numbering (even though it has the D-number labelling on the board).
I changed it to like this, and this is the result, still the same
// Pin definitions #define windPin 2 // Receive the data from sensor
// Definisi konstanta
const float pi = 3.14159265; // pi number
int period = 10000; // Periode pengukuran (milidetik)
int delaytime = 10000; // Waktu antar sampel (milidetik)
int radio = 90; // Jarak dari pusat kincir angin ke cangkir luar (mm)
int jml_celah = 18; // jumlah celah sensor
// Variable definitions
unsigned int Sample = 0; // Sample number
unsigned int counter = 0; // B/W counter for sensor
unsigned int RPM = 0; // Revolutions per minute
float speedwind = 0; // Wind speed (m/s)
void setup()
{
// Set the pins
pinMode(2, INPUT);
digitalWrite(2, HIGH);
// sets the serial port to 9600
Serial.begin(9600);
// Splash screen
Serial.println("ANEMOMETER");
Serial.println("**********");
Serial.println("Based on depoinovasi anemometer sensor");
Serial.print("Sampling period: ");
Serial.print(period/1000);
Serial.print(" seconds every ");
Serial.print(delaytime/1000);
Serial.println(" seconds.");
Serial.println("** You could modify those values on code **");
Serial.println();
}
@muhammadyudi
8266 stuff is NOT as carefree as good ol' arduino.
soft wdt reset
software watchdog timer
the loop is NOT looping around fast enough.
@SteveMann
just noting my admittedly less than exhaustive experience with onboard LED near the antenna (that wemos & nodemcu have in common).
Any insight/s on this anemometer matter?
I looked into this more.
When I select the 'WemosD1R1' board and Upload to a Wemos: the D-numbers do not work.
When I select the 'Nodemcu-12E' board and Upload to a Wemos: the D-numbers work.