Figure 4-9. Device Selection Wizard
A new project with a
main.c
file associated with it will be generated in Atmel Studio.
5.
Replace the
main
function in the
main.c
file with the following code snippet:
int main (void)
{
/* STK600 have eight User Buttons and eight User LEDs which can be connected to any IO
pin using cables */
/* Configure PB0 as input (remember to connect SW0 to PB0 using a cable */
PORTB.DIRCLR = PIN0_bm;
/* Configure PB1 as output (remember to connect LED0 to PB1 using a cable*/
PORTB.DIRSET = PIN1_bm;
while (1)
{
/* Check the status of SW0 */
/* 0: Pressed */
if (!(PORTB.IN & (PIN0_bm)))
{
/* LED0 on */
PORTB.OUTCLR = PIN1_bm;
}
/* 1: Released */
else
{
/* LED0 off */
PORTB.OUTSET = PIN1_bm;
}
}
}
In the code editor, the code should appear as shown in the figure below.
AN2653
Atmel Studio Users Getting Started
©
2018 Microchip Technology Inc.
Application Note
DS00002653A-page 17