Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ledPin = 13;
- void setup(){
- //Startup serial at 9600 BAUD
- Serial.begin(9600);
- //Set pin 13 to OUTPUT
- pinMode(ledPin, OUTPUT);
- }
- void loop(){
- /* Read and report data from serial, while the serial console
- * is available, and set the LED on.
- *
- * If the serial console is not available, set the LED low and
- * wait for more input.
- */
- while(Serial.available() > 0){
- Serial.write(Serial.read());
- digitalWrite(ledPin, HIGH);
- } if(Serial.available() == 0){
- digitalWrite(ledPin, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment