Shop OBEX P1 Docs P2 Docs Learn Events
oddity — Parallax Forums

oddity

s2jesses2jesse Posts: 62
edited 2009-03-25 00:03 in Propeller 1
am i having a brain fart? or what is the deal here..


· REPEAT 3
··· templat:=gps.latitude
··· waitcnt(80_000_000 + cnt)

· REPEAT·
··· gr.clear····
··· gr.text(50, 95,templat)
··· gr.copy(@__Screen)



ok first repeat loop is just setting a var template a couple times to the gps latitude string. im just testing and looping it 3 times to make sure it had time to grab it.

now after the 3rd loop the variable should be set to whatever gps.latitude was.

now in my second loop which just draws the value of templat to the screen should just simply·show the last value passed to templat in the earlier loop.. however its not. The display is·constnatly changing...· as if i was reading gps.latitude there.

again total brain fart? or am i missing something more complicated


fyi im using the gps io mini object which is working fine . gps.latitude just returns lat in a string
·

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-03-24 23:51
    strings are pointers so you are setting template to a pointer to the value of gps.latitude


    since it is a pointer and not the actual value if gps.latitude changes so will the value associated with the pointer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • s2jesses2jesse Posts: 62
    edited 2009-03-25 00:00
    ahh i see
    would i then just have to make an array of bytes and then a loop to fill and read it?

    Post Edited (s2jesse) : 3/25/2009 12:05:41 AM GMT
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-25 00:03
    yes an array of bytes with a function to copy the bites would do the job to copy your string. you can stop copying when you hit a 0

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
Sign In or Register to comment.