🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    GPS: calculate deviation between two course

    UIFlow
    2
    2
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      okneib
      last edited by

      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
      label6.setText(str(setcourse))
      pass
      btnC.wasPressed(buttonC_wasPressed)

      curcourse = gps.course

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

      Any suggestions?
      Thanks!!!

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by ajb2k3

        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.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • First post
          Last post