I think that in many cases a variable is used for a pin. Actually, the bigger my sketch, the more I use variables for pin numbers. That means your code and the Arduino functions should used together ? and the Arduino functions can not be replaced by your code ?