Shop OBEX P1 Docs P2 Docs Learn Events
I/o questions and etc — Parallax Forums

I/o questions and etc

HexaHexa Posts: 3
edited 2014-12-05 23:35 in BASIC Stamp
Hi, I just started learning about coding few weeks ago and I was trying to make a game like simon says with 4 buttons and 4 LEDs

the problem that im trying to solve is, how can I use the guide and use it with 3̶ LEDs?

Thank you for your help!

Comments

  • ercoerco Posts: 20,256
    edited 2014-11-27 15:29
    Hexa: Welcome to the forums. That's a great project and a perfect learning opportunity for you. When I taught BASIC programming to college art students, they coded a Simon game into a BS1, among other projects. You have a BS2, which is bigger & better. Seize this opportunity to learn about flowcharting and programming. You'll benefit from a few struggles. Ask specific questions here after you get started, but you're only hurting yourself if you ask for (and someone gives you) the complete answer here. BTW if you add a piezo buzzer, the game gets even better! Also, your game will play better if you rearrange your parts on the board so each switch is right by its corresponding LED.

    Enjoy the quest! :)
  • GenetixGenetix Posts: 1,749
    edited 2014-11-29 13:32
    What's a Microcontroller teaches the basics of using the BS2.
    http://www.parallax.com/sites/default/files/downloads/28123-Whats-a-Micro-v3.0.pdf

    Chapter 2 is on LEDs and Chapter 3 is on Pushbuttons.
    There is a similar game to the one you saw on Learn at the end of Chapter 3.

    The Basic Stamp Manual explains how to use every command in detail and has some simple wiring examples.
    http://www.parallax.com/sites/default/files/downloads/27218-Web-BASICStampManual-v2.2.pdf
  • HexaHexa Posts: 3
    edited 2014-12-03 14:16
    erco wrote: »
    Hexa: Welcome to the forums. That's a great project and a perfect learning opportunity for you. When I taught BASIC programming to college art students, they coded a Simon game into a BS1, among other projects. You have a BS2, which is bigger & better. Seize this opportunity to learn about flowcharting and programming. You'll benefit from a few struggles. Ask specific questions here after you get started, but you're only hurting yourself if you ask for (and someone gives you) the complete answer here. BTW if you add a piezo buzzer, the game gets even better! Also, your game will play better if you rearrange your parts on the board so each switch is right by its corresponding LED.

    Enjoy the quest! :)
    Thank you for your words! yeah, i understand why I shouldn't just get the whole codes
    Genetix wrote: »
    What's a Microcontroller teaches the basics of using the BS2.
    http://www.parallax.com/sites/default/files/downloads/28123-Whats-a-Micro-v3.0.pdf

    Chapter 2 is on LEDs and Chapter 3 is on Pushbuttons.
    There is a similar game to the one you saw on Learn at the end of Chapter 3.

    The Basic Stamp Manual explains how to use every command in detail and has some simple wiring examples.
    http://www.parallax.com/sites/default/files/downloads/27218-Web-BASICStampManual-v2.2.pdf
    Thanks a lot for this, i have been reading them over for a week now but i still don't understand some parts.

    I have decreased the number of LEDs in this project to 3 instead.

    Now my question is that is button is stuck on "Active-low' state (its showing 1 instead of 0 when UNpressed), how can I fix this?
    MIg7VsM.jpg
  • ercoerco Posts: 20,256
    edited 2014-12-03 15:27
    There's nothing wrong with active low, looks like you have that hooked up and working properly. You can either change your code (swap 1s & 0s in your IF checks) to accommodate active low, or you can change your wiring to make the button active high.
  • GenetixGenetix Posts: 1,749
    edited 2014-12-03 16:40
    You don't have the switch wired as an Active-High pushbutton. Look at the schematic again.
    I/O Pin - 220 ohm resistor --- Pushbutton - Vdd
    |_ 10K - Vss

    Notice the 220 is between the I/O pin and the switch. The 10K resistor connects the I/O pin to Vss and the Pushbutton connects the I/O pin to Vdd.
    You have the I/O pin connected to Vdd through a 10K which is ok if you wanted an Active-Low pushbutton, but the 220 ohm resistors do not go after the switch.
    The 220s should be where you have those small wires and to make the switch Active-High swap Vdd and Vss.
  • HexaHexa Posts: 3
    edited 2014-12-05 23:35
    erco wrote: »
    There's nothing wrong with active low, looks like you have that hooked up and working properly. You can either change your code (swap 1s & 0s in your IF checks) to accommodate active low, or you can change your wiring to make the button active high.
    Although I was thinking of swapping the 1s & 0s, I chose to change the wiring way for learning purpose. =D
    Genetix wrote: »
    You don't have the switch wired as an Active-High pushbutton. Look at the schematic again.
    I/O Pin - 220 ohm resistor --- Pushbutton - Vdd
    |_ 10K - Vss

    Notice the 220 is between the I/O pin and the switch. The 10K resistor connects the I/O pin to Vss and the Pushbutton connects the I/O pin to Vdd.
    You have the I/O pin connected to Vdd through a 10K which is ok if you wanted an Active-Low pushbutton, but the 220 ohm resistors do not go after the switch.
    The 220s should be where you have those small wires and to make the switch Active-High swap Vdd and Vss.
    Thanks a lot, this was very helpful!

    Im going to do the coding next and I'll let you guys know if I have any question! Thanks a guys!
Sign In or Register to comment.