can we call a function using a variable
senario
Posts: 1
hello guys
i am a newbie in propeller and don't know much about spin
i wanted to know that can we call a function using a variable
this is not the full code
instead of function can we assign a variable to one or two on that place
i had tried a lot and i need some help now
any kind of help will be appreciated
thanks
i am a newbie in propeller and don't know much about spin
i wanted to know that can we call a function using a variable
this is not the full code
[FONT=comic sans ms][SIZE=4] [/SIZE][/FONT] cognew(function(23,clkfreq), @stack[10]) PUB one (pin,rate) dira[pin]~~ repeat 2 outa[pin] := 1 waitcnt(rate + cnt) outa[pin] := 0 waitcnt(rate + cnt) PUB two (pin,rate) dira[pin]~~ repeat 5 outa[pin] := 1 waitcnt(rate + cnt) outa[pin] := 0 waitcnt(rate + cnt)
instead of function can we assign a variable to one or two on that place
i had tried a lot and i need some help now
any kind of help will be appreciated
thanks
Comments
There is a thread going on here about method or object pointers possibly being implemented in the next version of Spin.
Why don't you just add another parameter to the pin toggling function that takes the toggle rate 2 or 5.
Something like: