Shop OBEX P1 Docs P2 Docs Learn Events
Button Debouncing in Another Cog — Parallax Forums

Button Debouncing in Another Cog

floflo Posts: 38
edited 2010-04-10 20:43 in Propeller 1
I'm trying to send serial commands to my propeller from my computer while the propeller sends button states back to the computer.

My main cog wasn't able to keep up with the serial commands it was receiving, while it also had to do button debouncing, so I moved the button code into its own cog.

What I was hoping would happen is the main cog would send the computer the string of a button state that the button cog generated: getLastCommandStringAddress

In my main cog, I have this:

[b]OBJ[/b]

  Buttons : "ButtonAndKnobScan"

[b]PUB Main[/b]

  Buttons.start 

  repeat
        {{... unrelated stuff here}}

         Comm.str(Buttons.getLastCommandStringAddress)





However, the propeller is either sending empty strings to the computer or nothing at all. However, I know it hasn't crashed because I can still send serial strings to the propeller. Am I using the address point syntax correctly?

Comments

  • mparkmpark Posts: 1,306
    edited 2010-04-10 15:00
    PUB getLastCommandStringAddress : requestedStringAddress
    
            requestedStringAddress := [s]@[/s]commandString  '<=== remove @
    



    commandString contains the address of a string, so just return commandString, not @commandString.
  • floflo Posts: 38
    edited 2010-04-10 19:53
    Thanks for the .... pointer lol.gif you pointed me in the right direction.

    Unfortunately, still getting empty strings. smhair.gif
  • mparkmpark Posts: 1,306
    edited 2010-04-10 20:43
    I just noticed that you define commandString as a byte array. Change it to a long.
Sign In or Register to comment.