Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

LED example program with 3pi robot

I have problems about this code: I do not understand which button I have to push and how works the line " button_state = ioport_get_pin_level(GPIO_PUSH_BUTTON_0);" :

#include <asf.h>
int main (void)
{
	/* set board io port */
	board_init();
	bool button_state;
	while(1){
		button_state = ioport_get_pin_level(GPIO_PUSH_BUTTON_0);
		if(button_state){
			LED_Off(LED0);
		}else{
			LED_On(LED0);
		}
	}	
}

Hello.

I moved your post to our Robots sub-forum, which seems more appropriate.

Where did you get that code?

- Amanda