Shop OBEX P1 Docs P2 Docs Learn Events
Newbie to Parallax, using Quickstart board for learning Spin - Question on Touchpad — Parallax Forums

Newbie to Parallax, using Quickstart board for learning Spin - Question on Touchpad

kvaneppskvanepps Posts: 10
edited 2012-01-21 21:42 in Propeller 1
I just received the Quickstart board and I am going through the Propeller Education Kit manual. I know it does not use the Quickstart board but I thought I could go through the sample problems to understand how the spin language works. This is fine until I try to read pushbutton switch states as input since the Quickstart board has a touchpad. I could use the header connector with pull-up resistors and ground the pins but I would like to use the touchpads. I tried the touchpad demo (TouchButton LED Demo) but I don't see any information on reading a single touchpad.

Is there any information on what commands can be used with the touchpad object? Sorry for such a simple question.

My intention is to use the Quickstart board to send in a command via the serial interface and then decode the command I receive and bit-bang one of the output pins. I know it will work but I need to understand how to use the spin language.

Thanks
Ken

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-21 19:53
    Ken,

    I just showed Jose how to use the touchpads in a similar way to buttons. Start with post #15 of this thread and follow the directions in post #17. You'll need to use a modified version of the touchpad object that's part of the code in my QuickStart servo tester program (there's a link in post #15 of the thread I just mentioned).

    Let me know if you have any trouble.
  • doggiedocdoggiedoc Posts: 2,245
    edited 2012-01-21 20:02
    Hey kvanepps! Welcome to the forums!

    Heres a PUB method I used with the quickstart board. The original thread can be found here.
    PUB GetButton | buttonPressed
    
      dira [7..0]~
      buttonPressed := ina [7..0]
      case buttonPressed
        %10000000:
          thePin := 23
        %01000000:
          thePin := 22
        %00100000:
          thePin := 21
        %00010000:
          thePin := 20
        %00001000:
          thePin := 19
        %00000100:
          thePin := 18
        %00000010:
          thePin := 17
        %00000001:
          thePin := 16
                        
    

    This example reads all 8 buttons and sets the global variable "thePin" to a particular value depending on which button pressed. You should be able to easily adapt it to your needs.


    Paul
  • kvaneppskvanepps Posts: 10
    edited 2012-01-21 20:46
    Duane... Thank you!!! It worked great. I am currently working on understanding methods and calling them within a method. Your answer jumped me ahead to objects but I can see how this works....

    Thanks again

    Ken
    Duane Degn wrote: »
    Ken,

    I just showed Jose how to use the touchpads in a similar way to buttons. Start with post #15 of this thread and follow the directions in post #17. You'll need to use a modified version of the touchpad object that's part of the code in my QuickStart servo tester program (there's a link in post #15 of the thread I just mentioned).

    Let me know if you have any trouble.
  • kvaneppskvanepps Posts: 10
    edited 2012-01-21 20:47
    Paul,

    I think this method would only work for push-buttons, not for the capacitive touch pad that the Quickstart board has.

    Thanks
    Ken
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-21 21:42
    Ken,

    Paul's method of doing this and mine are very similar.

    The buttons' (touchpads') states are held in one byte with Pauls code. I use a byte for each pad in mine. I think mine might be easier for someone who isn't familar with checking the state of individual bits within a byte.

    Paul's method uses less memory to store the pad states. Pauls method makes it easier to display the pad states on the LEDs. Both methods have their advantages.
Sign In or Register to comment.