/*   Serial communication with the Arduino 
 *   using any serial communication application
 * Setup: Wire an LED from digital pin 6 thru 330ohm resistor to gnd
 * 
 * Note: "analogWrite()" only works on pins that can do 
 *        PWM (Pulse-Width Modulation) Pins: 3, 5, 6, 9, 10, 11
 */
 
 byte inByte;
 int ledPin = 6;

 void setup(){
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);          // set digital pin 6 as output
 }

void loop(){
    if (Serial.available() > 0){       // only if serial data's there
       inByte = Serial.read();         // read it, store in inByte
       delay(15);                         
       analogWrite(ledPin, inByte);    // light LED, otherwise
       }
 }
