Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test buttons #2

Open
GoogleCodeExporter opened this issue Aug 20, 2015 · 9 comments
Open

test buttons #2

GoogleCodeExporter opened this issue Aug 20, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

Here is a simple program that uses the Peggy library to test the buttons on
the board.  Note that button B0 corresponds to PORT B pin 0 and buttons B1
- B5 correspond to PORTC pins 0 - 4 respectively.

When I first looked at the sample code "Bounce" I noticed that button B0
corresponded to PORT B pin 0. Soooooooo, I didn't bother to look at the
schematic and instead assumed buttons "B1" - "B5" were attached to PORT B
pins 1 - 5.  Nope!  So I thought this simple sample might be helpful for
others who are just getting started with the board.


Original issue reported on code.google.com by [email protected] on 17 Jun 2008 at 4:23

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Here is the object version.  Note that you have to include <avr/io.h> in 
Button.h to
be able to use  terms like DDRB and PINB.

Original comment by [email protected] on 17 Jun 2008 at 5:40

Attachments:

@GoogleCodeExporter
Copy link
Author

I agree that it is useful to give some example code that shows how to use the 
buttons.    However, we're not 
exactly hiding how to use them.   One of the very first code examples that we 
posted-- even before we 
considered the object library-- was peggy_life.pde, which does use of all of 
the buttons.

This code example (ButtonsTest.pde) might make a useful addition to our main 
branch.  While there is not 
*much* benefit to writing a library to access the buttons, it is probably a 
good idea if there are to be library 
functions that it stay separate as you have done-- the Peggy2 library is 
already a bit fat.  

Two things that are important to change:
1. The library needs to say that it's for Peggy 2, not just for "Peggy".  (This 
code will not work with Peggy 1.0, and 
it *may not* work with Peggy 3.0, if and when that ever happens.  Having all of 
the major functions in libraries 
will make it easy to deal with any future hardware changes....)
2. There is not a button called "b0." there is S2 and then there are b1-b5.

I have some other comments I'll add in a bit.

Original comment by [email protected] on 17 Jun 2008 at 8:33

@GoogleCodeExporter
Copy link
Author

I'm not sure that I see the utility of defining an object class of button-- 
there may well be some that I do not 
see... Anyone have an opinion on the subject?

Regardless, I'm attaching a revised version of your library-less code example, 
in which a couple of useful 
functions are defined:

void buttoninit(void)
unsigned short ButtonVector(void)  // Returns state of all buttons as a vector
unsigned short ButtonDown(unsigned short ButtonNumber) // Returns state one 
button

Also: Define button names:
#define selectButton 0
#define anyButton 1
#define leftButton 2
#define downButton 3
#define upButton 4
#define rightButton 5




Original comment by [email protected] on 17 Jun 2008 at 11:07

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 7 Jan 2010 at 5:08

  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

You have to load software with arduino the game of life in Conway?
 thanks

Original comment by [email protected] on 14 Feb 2012 at 12:39

@GoogleCodeExporter
Copy link
Author

I do not think that the Game of Life is relevant to this issue (button test 
program). 

Example code for Peggy2, for Conway's Game of Life is available here, both in 
an AVR-GCC example and an Arduino .pde example: 
http://www.evilmadscientist.com/article.php/programpeggy2

Original comment by [email protected] on 14 Feb 2012 at 12:48

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

This is a highly inappropriate use of the bug tracker.  I've removed your 
subsequent comment.  

If you have a tech support request for a Peggy (including how to program it) 
please direct that to the Evil Mad Scientist Laboratories forums or to the 
contact form at Evil Mad Science:

http://www.evilmadscientist.com/forum/index.php?forum=14
http://evilmadscience.com/contact

Original comment by [email protected] on 14 Feb 2012 at 5:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant