Code:
#include "RP6RobotBaseLib.h"
#include <math.h>

int16_t x_start = 0;
int16_t y_start = 0;
  
int main (void) 
  {
  initRobotBase();
  	
  int16_t x_ziel = 500;
  int16_t y_ziel = 500;
  
  int16_t alpha2 = atan((y_ziel - y_start)/(x_ziel - x_start)) * 180/M_PI;
  int16_t c = (y_ziel - y_start) / sin(alpha2);
  
  char* c2 = "";
  dtostrf(alpha2, 10, 0, c2);

  writeString(c2);
  writeString_P("\n"); 
  
  while (true)
    {
	}
  return 0;
  }
Hallo,
wenn ich x_start u. y_start außerhalb von main definiere, kommt bei alpha2 44 raus. Wenn ich x_start u. y_start innerhalb definiere, kommt 45 raus. Richtig ist 45. Wieso ist das so? x_start u. y_start sind ja in der main funktion trotzdem noch 0, auch wenn sie außerhalb definiert werden.