Hi,
im a newbee to electronics

. im a SE so i understand the programming logics but the problem i have is that
for example is i want and npn transister to work as a switch how can i find which transister to buy(the code)? and how is this codes made(is there any logic behind the code)?
same with the ICs , i understand that ic is a circuit of functions covered by its datasheet but how can i find the correct ic i need for my task
this is a project i did few days ago, basically its 2 3 segment displays i brought from ebay along with a ultrasonic sensor thinking to build a speed cam but the ultrasonic sensor was dead already(i think i broke it) because it gives 0cm all the time(i may have connected the gnd and vcc wrong first time). but i managed to hook up the display after reading about how 7segs work.
but it took all my pins (7segments+3+3) so if i needed to connect the ultrasonic sensor how can i do it? is there anyway to reduce the number of pins i used?
as you can see here
https://www.box.com/s/x8dx05rqz93aywf3urmgits a pretty lengthy way of doing it
<iframe width="560" height="315" src="
http://www.youtube.com/embed/h74paWLDPyY" frameborder="0" allowfullscreen></iframe>
please help me understand these.
thanks in advance