newbie need  ir sensor speed control codeing

im new to the arduino and to coding in C im having fun with the examples but im looking to use the ir emitor/sensor that came with my kit to control a motors speed using a black and white wheel.

And im reading the web to try to learn c coding but im finding out, that may not be the best way. C seem to have alot of different styles that as a newbie makes it a bit hard to learn that way. whats the best book or place to get coding for the arduino that teaches newbie from a to z without jumping around like the net.