I am an absolute beginner in the MCU field but kind of an intermediate in C language. For my Microcontrollers class, we were asked to build a dice simulator using LEDs, a button, and a PIC12f683. Here's a screenshot of the hardware I designed:

I am using SDCC to compile the C code and has been working fine so far, the example code we were given at the very beginning was an LED blinking every 100 time units. Now that I built all of that hardware I want to press the switch and turn the LEDs ON for a second and then turn them OFF but they are remaining ON all the time until I disconnect the switch. Here's the code I am using:

I am using SDCC to compile the C code and has been working fine so far, the example code we were given at the very beginning was an LED blinking every 100 time units. Now that I built all of that hardware I want to press the switch and turn the LEDs ON for a second and then turn them OFF but they are remaining ON all the time until I disconnect the switch. Here's the code I am using:
C:
#include <pic14/pic12f683.h>
// Pins are defined here for easier further manipulation
#define one 0b00000001
#define two 0b00000010
#define three 0b00000011
#define four 0b00000110
#define five 0b00000111
#define six 0b00010110
// Functions preamble
void delay (unsigned char tiempo);
// Main fucntion
void main(void)
{
TRISIO = 0b00001000; // All pins as outputs
GPIO = 0x00; // All pins DOWN
ANSEL = 0x00;
unsigned char time = 10;}
// Matrix to store dice numbers in function of the LED configuration
unsigned char led_matrix[6] = {one, two, three, four, five, six};
while (1)
{
do
{
GPIO = led_matrix[5];
delay(time);
GPIO = 0x00;
} while (GP3 == 1);
}
}
void delay(unsigned char tiempo)
{
unsigned char i;
unsigned char j;
for(i=0;i<tiempo;i++)
for(j=0;j<1275;j++);
}