GPS: calculate deviation between two course

  • Hi,
    I'm new to UIFlow and Pyhton and run into a problem:

    I get a course from GPS and store it (after button press) in courseset.
    After that I want to show the deviation but it cannot make the calculation:

    def buttonC_wasPressed():
    global setcourse, curcourse, coursediff, gps
    if curcourse:
    setcourse = curcourse

    curcourse = gps.course

    coursediff = curcourse - setcourse. // this line results in "Can't convert 'float' object to str implicitly"

    Any suggestions?

  • Try (str(str(setcourse)))
    Putting the str in a second time sometimes works as it would appear that the original str sometimes get ignored.
    Why, I don’t know but I’ve used this trick myself a few times now.