jhughes1010 / weather

30 stars 17 forks source link

Wind direction #8

Closed johflo closed 2 years ago

johflo commented 2 years ago

Hi,

can you explain me how do you calculate the wind direction?

Kind regards Johannes

jhughes1010 commented 2 years ago

Not certain I understand "how to calculate?" Do you mean a low level understanding of the voltage divider operation? Perhaps you mean "how to calibrate or align?". I want to give you the answer you are looking for :)

johflo commented 2 years ago

I tried to comprehend the calculation of the analogCompare[15] values related to the windDirText[15]. If I try to calculate the values the highest value would be on 270°

jhughes1010 commented 2 years ago

Obviously, you can orient the vane any way you wish. I would suggest you create a simple standalone sketch that continuously outputs values and directions for reorientation though. Mark your 270 position with a dot.

Code overview: There are 16 positions to deal with. I set the position found to the highest ADC value and read the ADC port. I iterate through the other 15 values from low to high to "prove me wrong" that I'm not at position 16.

Let me know if this does not make sense.

johflo commented 2 years ago

Thanks for your explanation. Now it's clear for me.