how does a microcontroller work
microcontroller is basically a computer in a single silicon chip who have RAM, ROM (or FLASH memory), Timer, Interrupt, IO Port etc..
pins on a microcontroller mostly are IO, who have a spesific function given by its internal program.
microcontroller must have a program to wprking properly as we want. try further reading on microcontroller to understand how tey work, how to write a microcontroller program in C/C++, BASIC or PASCAL and learn how to program a microcontroller..there is plenty of e-books on the net.. CMIIW and good luck