I have problems in getting to grips with serial communication in the Arduino. Sending serial data to a connected device, usually a PC is straightforward, the device has a buffered reader to read the arduino output as usuable strings and integers. But getting the Arduino to read a number sent from a device is tricky. Say the number you want to send is 2333, the numbers are sent one by one as ascii which then has to be read into a char array (arduino string). Then the string can be transformed into an integer with the atoi function. To view the code click here
Below picture shows a photo of the wiring to fade an LED using a pwm pin on the Arduino. It is a good circuit to test communication and the quality of sensor inputs. Remember short leg of an LED is ground and long leg is positive.
The code to run a simple loop can be picked up here.

Below is an illustration of the postioning of wires and resistor in the simplest sensor circuit
