Sunday, June 20, 2010

Arduino learning-10

Opens serial port and sets the baud rate for serial data transmission. The typical baud rate for communicating with the computer is 9600 although other speeds are supported.
void setup()
Serial.begin(9600); // opens serial port
} // sets data rate to 9600 bps
Note: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time.
Prints data to the serial port, followed by an automatic carriage return and line feed. This command takes the same form as Serial.print(), but is easier for reading data on the Serial Monitor.
Serial.println(analogValue); // sends the value of
// 'analogValue'
Note: For more information on the various permutations of the Serial.println() and Serial.print() functions please refer to the Arduino website.
The following simple example takes a reading from analog pin0 and sends this data to the computer every 1 second.
void setup()
Serial.begin(9600); // sets serial to 9600bps
void loop()
Serial.println(analogRead(0)); // sends analog value
delay(1000); // pauses for 1 second
26 |
Related Posts Plugin for WordPress, Blogger...
Disclaimer: All the information in this blog is just gathered from different sites in the web and placed here and I am not the owner for these content

Popular Projects


My Blog List

Give Support

Give Support
Encourage me Through Comments & by Following