비슷한 질문이 있지만 솔루션을 찾을 수없는 것으로 알고 있습니다. 나는 함수를 반환이 코드를 사용하고 있지만, 작동하지 않는 것 :오버로드 된 함수 호출 double이 모호합니다.
#include <math.h>
// Computes the bearing in degrees from the point A(a1,a2) to
// the point B(b1,b2). Note that A and B are given in terms of
// screen coordinates
double bearing(double a1, double a2, double deg, double degy) {
a1 = 37.40733;
a2 = -121.84855;
static const double TWOPI = 6.2831853071795865;
static const double RAD2DEG = 57.2957795130823209;
// if (a1 = b1 and a2 = b2) throw an error
double theta = atan2(deg - a1, degy + a2);
if (theta < 0.0)
theta += TWOPI;
return RAD2DEG * theta;
Serial.print(bearing);
}
을 나는이 오류 메시지가 수신 계속 :
Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\family\Documents\Arduino\GPStester\GPStester.ino: In function 'double bearing(double, double, double, double)':
GPStester:90: error: call of overloaded 'print(double (&)(double, double, double, double))' is ambiguous
Serial.print(bearing);
note: no known conversion for argument 1 from 'double(double, double, double, double)' to 'long unsigned int'
exit status 1 call of overloaded 'print(double (&)(double, double, double, double))' is ambiguous ambiguous
'Serial.print (bearing); '에 도달 할 수없는 코드가있는 것 같습니다. –
arduino를 프로그래밍하지 않지만 오류 메시지가 'Serial.print'에 의해 예상되는 인수가 'long unsigned int'임을 나타내는 것으로 보입니다. 함수에 대한 포인터를 전달하고 있습니다. –
주석에서 "점 B (b1, b2)"를 말하고 매개 변수에서 "deg"및 "degy"라고 말하는 것은 매우 혼란 스럽습니다. 이러한 매개 변수가 "B"인지 아닌지? 각도는 각도로 표시됩니다. – molbdnilo