/* Battery Test Serial Writer * Sends a serial heartbeat that indicates that battery power * is still sufficient. When the battery dies, the heartbeat will stop */ int ledPin = 13; // select the pin for the LED int outputPin=9; void setup() { pinMode(ledPin,OUTPUT); // declare the LED's pin as output beginSerial(9600); // connect to the serial port blinkLED(ledPin, 2, 100); } void loop () { for(int value = 0 ; value <= 255; value++) // fade in (from min to max) { analogWrite(outputPin, value); // sets the value (range from 0 to 255) delay(2); // waits for 30 milli seconds to see the dimming effect } for(int value = 255; value >=0; value--) // fade out (from max to min) { analogWrite(outputPin, value); delay(2); } // blinkLED(blinkerPin, 1, 1); int printValue = 255; // int printValue = analogRead(0)/4; Serial.println(printValue); //delay(998); } // this function blinks the an LED light as many times as requested void blinkLED(byte targetPin, int numBlinks, int blinkRate) { for (int i=0; i