Arduino Meg2560 Example Tutorial

Arduino Meg2560 Sample tutorial


The above products are suitable for this tutorial

一、Download sample program

Arduino Meg2560示例程序(Arduino Meg2560sample program)

二、Copy program to library

三、Compile the downloader configuration program

There is no need to connect our product when compiling the program. If it is connected, it will occupy the download serial port and cause the download to fail and report an error.

1、Select Tools->Choose com port->Then select the model of the development board "Arduino mega or mega2560", and finally select to obtain the development board information. If the board information is successfully obtained, there is no problem.

2、Select Tools -> Programmer -> select Arduino as spi

三、Program baud rate selection

The baud rate corresponds to the product baud rate jy901 is 9600 baud rate (JY61 is 115200)

四、Compile and download

The board is connected to the computer separately, check the above steps, click upload if there is no problem, and there will be a prompt that the upload is complete after the upload has a progress bar. (The board is connected to the computer, the sensor should not be connected to the board)

五、Wiring of sensor and board

When wiring, the serial port wiring needs to be connected to the TTL interface on the board. The wiring is as follows

VCC is connected to 5v, TX is connected to RX, RX is connected to TX, and GND is connected to GND.

六、View data with serial port

Connect the arduino board to the computer, and then use the serial port tool to view the data without checking the hexadecimal system.

  1. If the output is garbled, the baud rate is wrong

  2. If the output data are all 0, it may be that the baud rate of the sensor and the program baud rate in the board are not aligned, it is 0, because the baud rate of the board and the sensor are not aligned. As a result, the communication fails and the data cannot be obtained, so the output is all 0; it is also possible that the pin headers of the board are not welded properly, which will also cause the output data to be 0.

Last updated