Page 1 of 1

Defining or Returning Byte Arrays in User Macros

Posted: Sat Oct 22, 2022 5:56 pm
by jay_dee
Hi,
I have i2C read and write macro's . However I dont always want just a single return byte, I might be reading back anything from 1 to 6 bytes.
I see I can Return Strings, Longs, Integers. Can I return a Byte Array from a user Macro?

For the write macro, whilst I can create a parameter Byte Array to hold the 'write' data but how does the user load this array with values using the flowcode user macro interface?

Or am I better just building a set of simpler macros for 1, 2,3,4,6 bytes to be read / written ?
Thanks, J.

Re: Defining or Returning Byte Arrays in User Macros

Posted: Sat Oct 22, 2022 6:00 pm
by mnfisher
Pass the array as a parameter - if you 'modify' it (or write data to it) it will return the data as you wish.
(Arrays are passed by reference rather than by value - but note that strings have an option to create a local copy)

Martin