User Tools

Site Tools


arduino:serial_communication

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
arduino:serial_communication [2012/09/14 00:51] – created mithatarduino:serial_communication [2012/09/14 01:02] mithat
Line 12: Line 12:
 void setup() { void setup() {
   Serial.begin(9600);  // initialize serial communication at 9600 bits/second   Serial.begin(9600);  // initialize serial communication at 9600 bits/second
 +
   pinMode(pushButtonPin, INPUT);      // make the pushbutton's pin an input   pinMode(pushButtonPin, INPUT);      // make the pushbutton's pin an input
   digitalWrite(pushButtonPin, HIGH);  // turn on pullup resistors   digitalWrite(pushButtonPin, HIGH);  // turn on pullup resistors
 +
   pinMode(ledPin, OUTPUT);            // make LED's pin an output   pinMode(ledPin, OUTPUT);            // make LED's pin an output
 } }
Line 21: Line 23:
    
   // set LED state accordingly   // set LED state accordingly
-  if (buttonState == HIGH)        // if the button is pushed+  if (buttonState == LOW)        // if the button is pushed
     digitalWrite(ledPin, HIGH);   // turn the LED on     digitalWrite(ledPin, HIGH);   // turn the LED on
   else                            // otherwise   else                            // otherwise
arduino/serial_communication.txt · Last modified: 2012/09/14 01:19 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki