Skip to content

Instantly share code, notes, and snippets.

@labsguru
Created August 22, 2022 06:14
Show Gist options
  • Select an option

  • Save labsguru/9800af87b190e10e371e4a57c9c79cfd to your computer and use it in GitHub Desktop.

Select an option

Save labsguru/9800af87b190e10e371e4a57c9c79cfd to your computer and use it in GitHub Desktop.
/*
Connect the voltage signal wire to Arduino analog interface:
Yellow Cable<---->A0
*/
void setup()
{
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
float outvoltage = sensorValue * (5.0 / 1023.0);
Serial.print("outvoltage = ");
Serial.print(outvoltage);
Serial.println("V");
int Level = 6*outvoltage;//The level of wind speed is proportional to the output voltage.
Serial.print("wind speed is ");
Serial.print(Level);
Serial.println(" level now");
Serial.println();
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment