Hello, we're 2 students that just started learning arduino. As of now we have a project to program a weatherstation. Were only gonna measure Temp, Humidity, and windspeed.
We got the temp and humidity to work. But we have no idea how to even start with the wind. Were using a motor speed sensor WYD H2010.
Were just gonna using something that could illustrate a fan going through and measuring the wind speed. Is it easiest to measure how many times it passes through per second and then use an equation and get the windspeed. Or is there a better way?
The code we have so far is:
#include <Wire.h>
#include "Adafruit_HDC1000.h"
int incomingByte = 0;
// Connect Vin to 3-5VDC
// Connect GND to ground
// Connect SCL to I2C clock pin (A5 on UNO)
// Connect SDA to I2C data pin (A4 on UNO)
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
void setup() {
Serial.begin(9600);
if (!hdc.begin()) {
while (1);
}
Serial.begin(9600);
}
void loop() {
incomingByte = Serial.read();
if (char (incomingByte)=='T'){
Serial.print(" Temperature: ");
Serial.println( hdc.readTemperature()); }
if (char (incomingByte)=='H'){
Serial.print(" Humidity: ");
Serial.println( hdc.readHumidity());
}
if (char (incomingByte)=='W'){ //Förberett för vinden
Serial.print(" Wind: ");
Serial.println( "buttonstate blablabla" );
}
if (char (incomingByte)=='E'){
Serial.print(" Temperature: ");
Serial.println( hdc.readTemperature());
Serial.print(" Humidity: ");
Serial.println( hdc.readHumidity());
Serial.print(" Wind: ");
Serial.println( "buttonstate blablabla" );
delay(1000);
}
Would be really nice with som pointers on the code, if theres something that is wrong with it. It works though. Were using a HDC100x.
So we only need to combine this code with code for the "windreader"
Help would be really appreciated, thanks alot!
}