/* Serial communication with the Arduino * using any serial communication application * Setup: Wire an LED from digital pin 6 thru 330ohm resistor to gnd */ byte inByte; void setup(){ Serial.begin(9600); pinMode(6, OUTPUT); // set digital pin 7 as input } void loop(){ if (Serial.available() > 0){ // only if serial data's there inByte = Serial.read(); // read it, store in inByte delay(15); analogWrite(6, inByte); // light LED, otherwise } } |