int vol = 0; int LED = 5; void setup() { // Set the LED pin to output, and start the Serial Comm. pinMode(LED, OUTPUT); Serial.begin(9600); } void loop() { // Read the volume and write it to the LED, and Serial for Debugging. vol = analogRead(A0); if (((vol/4)-99) < 0){ analogWrite(LED, 0); } else{ analogWrite(LED, (vol/3)-5); } Serial.println((vol/4)-16); }