Adding the main code file. it is to be copied and pasted into the arduino IDE for usage.