# SAM7 sample code for Buttons..

**URL:** <https://community.sparkfun.com/t/sam7-sample-code-for-buttons/20122>\
**Category:** MicroMod\
**Tags:** arm-lpc\
**Created:** [March 29, 2011, 3:41pm UTC](https://community.sparkfun.com/t/sam7-sample-code-for-buttons/20122 "2011-03-29T15:41:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![injioncloud](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@injioncloud](https://community.sparkfun.com/u/injioncloud)\
**Post date:** [March 29, 2011, 3:41pm UTC](https://community.sparkfun.com/t/sam7-sample-code-for-buttons/20122/1 "2011-03-29T15:41:35Z")

</div>

Dear Friends,

I am doing some sample projects with sam7-ex256 board and I would like to know if anyone can help me out with sample code for the buttons(how to write interrupt handler for buttons).I would like to do following things.

main(){

int i=10;

while(1){

//increment the value of i

//when the is button pressed or joystick is pressed

//print the value of i on lcd

//come out of the loop

//if button is not pressed keep incrementing the value of i

}

}

I have sample code for displaying the value of i , but i dont know how to write code for buttons…

Please help me out in this regard…If anyone needs sample code for LCD program you can mail me…
