Defining or Returning Byte Arrays in User Macros

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jay_dee
Posts: 198
http://meble-kuchenne.info.pl
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 76 times
Been thanked: 54 times

Defining or Returning Byte Arrays in User Macros

Post 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.

mnfisher
Valued Contributor
Posts: 1463
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 136 times
Been thanked: 713 times

Re: Defining or Returning Byte Arrays in User Macros

Post 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

Post Reply