Search for question
Question

-val: a value to send as a single byte. -str: a string to send as a series of bytes. -buf: an array to send as a series of bytes. -len: the number of bytes to be sent from the array. Return: write() will return the number of bytes written, though reading that number is optional. Data type: size_t. 3. Serial.read(): Description: Reads incoming serial data. Syntax: Serial.read() Parameters: Serial: serial port object. See the list of available serial ports for each board on the Serial main page. Return: The first byte of incoming serial data available (or -1 if no data is available). Data type: int. Page 16 of 16 4. Serial.available(): Description: Get the number of bytes (characters) available for reading from the serial port. Syntax: Serial.available() Parameters: Serial: serial port object. See the list of available serial ports for each board on the Serial main page. Returns: The number of bytes available to read. Data Processing/Data Storage Subsystems The microcontroller utilized in this lab project is the ATmega2560, which is found on the Arduino Mega 2560 board. This powerful microcontroller works at a clock speed of 16 MHz. It is equipped with 256KB of flash memory for storing the program code, SKB of SRAM for storing variables, and 4KB of EEPROM Data Processing Operation: <describe code statement and/or library function(s) used for processing data, for each library function used in the lab code, include following information: Description, Syntax, Parameters, Retum value> Description: Syntax: Parameters: Returns: Description: Syntax: Parameters: Returns:/nPage 16 of 18 Internal UART Point of interaction: The Arduino Mega 2560 board utilizes its internal UART interface for serial communication. The board has a few UART interfaces, one of which is associated with the USB point of interaction to permit serial data communication with the PC. ■ USB Point of interaction: The external communication with the PC is finished through the USB interface, allowing serial data to be sent to the PC where it's perused by the Processing environment. Thi USB association copies a serial port on the PC, which is a typical strategy for communication among microcontrollers and computers. 1. Serial.begin(): Description: Sets the data rate in bits per second (baud) for serial data transmission. Syntax: Serial.begin(speed) and Serial.begin(speed, config) Parameters: Serial: serial port object. See the list of available serial ports for each board on the Serial main page. speed: in bits per second (baud). Allowed data types: long. config: sets data, parity, and stop bits. Valid values are: SERIAL_5NI SERIAL_6N1 SERIAL 7N1 SERIAL 8N1 (the default) SERIAL_5N2 SERIAL_6N2 SERIAL_7N2 SERIAL 8N2 SERIAL 5E1: even parity SERIAL_6E1 SERIAL 7E1 SERIAL_8E1 SERIAL_5E2 SERIAL_6E2 SERIAL 7E2 SERIAL_8E2 SERIAL 501: odd parity SERIAL_601 SERIAL 701 SERIAL 801

Fig: 1

Fig: 2