Can a Method Parameter Call a Data Table Value?
coryco2
Posts: 107
I would like to have a method call a series of values from a data table via a passed parameter, like this:
The txData method works if I use char:=Data1[idx] in the repeat loop, but not if I try to pass the dataname as a parameter from myMethod. Why is this please? Is there some syntax I could use to get this to work? Thanks!
PUB MyMethod txData(Data1) PUB txData(dataname) | idx, char idx~ char~ repeat char:= dataname[idx] serial.tx(char) idx++ until char==255 DAT Data1 BYTE 45, 0, 12, 230, 255
The txData method works if I use char:=Data1[idx] in the repeat loop, but not if I try to pass the dataname as a parameter from myMethod. Why is this please? Is there some syntax I could use to get this to work? Thanks!
Comments
I think "dataAddress" would be a better variable name than "dataname".
Thanks Dave. I missed the lack of an address symbol.
Thanks to you both!