[Solved] CPE 325 Assignment #8

$25

File Name: CPE_325_Assignment_#8.zip
File Size: 197.82 KB

SKU: [Solved] CPE 325 Assignment #8 Category: Tag:
5/5 - (1 vote)

Assignment

  1. Implement the following functions in C:
void UART_initialize(); Configures UCI to work in the UART mode at the baud rate as follows: if your first name hasan even number of letters use 19200, otherwise use 115200.
voidUART_sendCharacter(char c); Sends a character via UART
char UART_getCharacter(); Waits for a character from UART and returns it.
void UART_sendString(char* string); Sends a string via UART usingsendCharacter(char c)
void UART_getLine(char* buffer, int limit); Receives characters via UART usingUART_getCharacter()until it finds the new line character or until the limit of characters is exceeded. Writes that string (excluding the new line character) to the buffer allocated outside of the function.Terminates the string with the null character.

Test your functions to make sure they work properly and none of them writes or reads nonallocated memory. Make sure that UART_getLine() inserts the null character at the end of your string, and does not exceed the limit, including the null character.

  1. Write a chat bot using functions from the previous part. When the user types Hey, Bot! and hits Enter, the bot greets the user and asks for their age. After age is entered, chat bot replies: You are so young! I am 1<x> years old!, where <x> is the age of the user. If the user enters 1000, the bot should reply This cannot be true!. Make sure each message in the chat starts from a new line. Specify author of each message as it is shown on the screenshot below (colored names are necessary for bonus part only):

Notes:

  • You can use snprintf function to concatenate strings, but make sure you do not overflow any buffers.
  • The bot should be ready to reply to the Hey, Bot! message again without resetting the board.
  • Use strcmp function to compare strings.
  • Echo characters back if you want to see what you type.
  • Use r
    sequence to properly start a new line.
  1. If the user has not communicated with your chat bot for longer than 15 seconds, the chatbot should send Is anybody here? to the terminal and repeat that message every 15 seconds until the user replies. Messages from the user should reset the wait time.
  2. [ Use different colors for the names of authors.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CPE 325 Assignment #8
$25