Minggu, Desember 15, 2013

Introduction to Arduino Serial.begin() Function

Before, we must know, what is serial communication, searching on google, stucked at http://desylvia.wordpress.com/, known that serial communication can analogous to journey of ants to hole at land. Ants marching orderly and enter the hole in the ground one by one. Ants are data in bit, whereas hole in the ground is a register accept bits sent. Essentially, processing of sending data on serial communication sent one by one.

OK, now we start again to learng Arduino sketch, at this time we will learn Serial.begin() function

Serial.begin() is used to sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate.

Sample sketch with explanation:

void setup() {
  Serial.begin(9600); // membuka serial port, mensetting kecepatan data ke 9600 bps

void loop() {}

We can write sketch without explanation:

void setup() {

void loop() {}

We will start practice:
  1. Connect Arduino to PC
  2. Verify sketch code
  3. After verifying successful, please upload sketch
  4. After done uploading, try to open Serial Monitor (Tools > Serial Moniotr / Ctrl+Shift+M / Click on Serial Monitor icon located at the right
  5. Please select baudrate (surrendered), baud rate selected must corresponding with baud rate on sketch code, select on the bottom right of Serial Monitor window
  6. Try type a character (e.g. Test)
  7. Click on Send or press Enter button
  8. When clicking on send or pressing Enter button, look at RX(Receive) lamp on ARduino board will blink, hypothesis, it signalize Arduino board has accept data typed on PC via Serial Monitor, it means has occur communication between PC with Arduino board

0 komentar: