Hi
Could you please advise as to how I write a lookup table for the below code ;
#include “mbed.h”
AnalogIn Wind_vane(PA_1);
float Vane_ain,Vane_angle;
Ticker Vane_Interrupt;
float Wind_vane= {0.0, 33000}, {22.5, 6570}, {45.0, 8200}, {67.5, 891},
{90.0, 1000}, {112.5, 688}, {135.0, 2200}, {157.5, 1410},
{180.0, 3900}, {202.5, 3140}, {225.0, 16000}, {247.5, 14120},
{270.0, 120000}, {292.5, 42120}, {315.0, 64900}, {337.5, 21880} ;
void Vane_Interrupt_handler()
{
Vane_ain=Wind_vane;
float old_Vane_ain=0;
if(Vane_ain!=old_Vane_ain );
{Vane_angle}
int main ()
{
old_Vane_ain=0;
Vane_Interrupt.attach(&Vane_Interrupt_handler,2.0);
while(1) {
ThisThread::sleep_for(500ms);
printf("Wind Direction is %4.2f\n",Vane_angle);
}
}
Regards