Shop OBEX P1 Docs P2 Docs Learn Events
passing an array — Parallax Forums

passing an array

JonathanJonathan Posts: 1,023
edited 2014-01-29 10:29 in Propeller 1
Hi All,

Working on a garden timer to integrate into my control system. I am having trouble with a simple array pass, my Spin is a little rusty. All I am doing is writing/reading timer settings to the eeprom. What am I doing wrong here?

byte timer1[10]

set_timer(@timer1,timer1addy) // call method

pub set_timer(pointer,timerAddy)| i
eeprom.writebyte(eeScl,eeAdr,timerAddy+i,pointer)


Hope the code comes out. I haven't figured out how to post code since it went weird. It all works fine if I substitute "timer1" for "pointer" I have the same problem with the read method.

Thanks!

Jonathan

Comments

  • RaymanRayman Posts: 14,659
    edited 2014-01-29 10:18
    problem is probably that "pointer" is really just a long value holding the address of the array, not a "real" pointer...
    So, you can't use pointer on it...

    I think you can do:

    byte[pointer]

    in place of pointer though.
  • JonathanJonathan Posts: 1,023
    edited 2014-01-29 10:29
    Ray,

    Udaman! Works as desired. I don't really get why, but that can be a mystery for another day. Thanks for the fast reply, took a bio break and came back to the answer!

    Jonathan
Sign In or Register to comment.