Shop OBEX P1 Docs P2 Docs Learn Events
Passing a variable amount of bytes — Parallax Forums

Passing a variable amount of bytes

MacGeek117MacGeek117 Posts: 747
edited 2008-01-07 00:11 in Propeller 1
How would I pass a variable amount of bytes, ranging from 0-8, from a top object to a lower one?
RoboGeek

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"

Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-06 23:51
    Pass the address of the first byte and the count of the number of bytes as two parameters.
  • MacGeek117MacGeek117 Posts: 747
    edited 2008-01-06 23:59
    I'm sorry, Mike-I'm going to need a code sample.
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I reject your reality and subsitute my own!"

    Adam Savage, Mythbusters
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.jameco.com
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-07 00:09
    OBJ
       myObj : "flibidib"
    
    VAR
       byte array5[noparse][[/noparse] 5 ], array6[noparse][[/noparse] 6 ]
    
    PUB main
       myObj.sample(@array5,5)
       myObj.sample(@array6,6)
       myObj.sample(string("Test String"),11)
    
    ' ---------- now in flibidib.spin
    
    PUB sample(array,length) | i
       repeat i from 0 to length-1
          dsp.out(byte[noparse][[/noparse] array ][noparse][[/noparse] i ])
    
    
  • MacGeek117MacGeek117 Posts: 747
    edited 2008-01-07 00:11
    Thanks Mike!!!!!!! Just what I need!
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I reject your reality and subsitute my own!"

    Adam Savage, Mythbusters
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.jameco.com
    ·
Sign In or Register to comment.