Shop OBEX P1 Docs P2 Docs Learn Events
Any ideas why FILE is not working for me? — Parallax Forums

Any ideas why FILE is not working for me?

Hello,

I'm scratching my head trying to get the bytes of a binary file into spin. I'm generating the file in Processing and contains only 32 bytes with numbers 0 through 31. Then I'm trying to consume this file in a spin method but all I get from the bytes in spin is 0.

The attached image shows the input file when it was generated, the same file read through another processing program byte by byte (to validate generation) and the spin program with debug in Pnut. You can see the results of each side by side. Any ideas are welcome!

Thanks.

Code:
CON
  _clkfreq = 160_000_000

PUB main() | i, b
  repeat i from 0 to 31
    b := byte[tree][i]
    debug(udec(b))

DAT
  tree  FILE  "tree.p2"
1920 x 1029 - 258K
FILE.png 258.4K

Comments

Sign In or Register to comment.