Shop OBEX P1 Docs P2 Docs Learn Events
LED question — Parallax Forums

LED question

RobbyjoeusnRobbyjoeusn Posts: 4
edited 2012-07-30 18:32 in BASIC Stamp
I'm building a rockem sockem robots kind of game, where the robots use pushbutton controlled servos to punch pushbuttons on the opposing chest. I was just curious if someone could help with code, I got most of it, but I was just curious for other ideas, specifically for 3 LEDS, red yellow green, to include a counter for 3 hits, that each hit would light all 3, but when 3 is reached, they would all light and flash.

I'm just not sure how to include the counter so if three hits on the PB happens, they'll all 3 flash along with the buzzer and the the display "hit" or "win" on the 2x16 LCD

any other suggestions would be appreciated, especially for wiring, since I have 2 servos, the lcd, the buzzer, 3 leds, and 4 pushbuttons

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-16 08:01
    This is a continuation of your thread in the Education Forum. Please don't start two threads on essentially the same question. If you want the other thread moved here, say so. In any event, cross-posting is not allowed here (two threads on the same subject) and won't really get you any better or quicker answers.
  • RobbyjoeusnRobbyjoeusn Posts: 4
    edited 2012-07-18 11:09
    Sorry mike. Didn't mean to crosspost. They were different questions anyhow and it seems this category fit better. Feel free to delete either or both as I have solved both issues already. I do have another question though maybe you or someone could enlighten me on. The momentary pushbuttons im using as chest targets are getting false positives as shown in the debug ? In3 window. Ideally, they should always be 0 until pushed, but the debug window has roughly 2 or 3 1s for every 10 zeroes. Any ideas?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-18 11:21
    It's probably contact bounce. There are several ways to suppress this, from using the BUTTON statement to adding a small capacitor across the switch contacts to using a SPDT pushbutton with a pullup and I/O pin for each contact and using one contact to indicate that the button is released (check first) and the other to indicate that it's pushed.
  • RobbyjoeusnRobbyjoeusn Posts: 4
    edited 2012-07-30 18:32
    Thanks Mike, the 10k resistors were just what I needed, and I'm happy to say the entire project came out really nice and looks great, Quick question however, The momentary pushbuttons I'm using for the chest targets work fine, but sometimes don't register a "hit" because the arm attached to the servo doesn't always have a clean enough hit with enough force to completely push the chest targets. It's still functional, but challenging nonetheless. Their these black circular momentary pushbuttons from Radio Shack, I don't have a PN, but anyhow, does anyone know off the top of their head a pushbutton that requires very little force to change state, or have any suggestions? If necessary, I can just move the pushbutton positioning, but I was thinking of just replacing them, or potentially lowering the amount of force necessary to make contact if that's possible. Here's a link to a silly video of it if you want a visual.
Sign In or Register to comment.