This page is located in archive. Go to the latest version of this course pages.

In this homework, the user will send commands to the LCD with PC. On the PC side, you should write a C code (named sender.c hereafter) similar to lab04 which reads a text file and sends it character by character to NUCLEO. The text file that sender.c should send contains these set of commands:

command1: DRAW:CIRCLE x,y,z;

command2: CLEAR;

command3: DRAW:LINE x,y,z,k;

In command1, after NUCLEO receives the command, it should draw a circle with the center of (x,y) and radius of z. If z is not passed, the default radius for the circle is 10.

The command2 will clean the LCD with white color.

Command3 will draw a line from point (x,y) to point (z,k).

Be aware that all commands end with ;. Also, use USART in blocking mode as provided in this template file for ac6 IDE new LCDs : hw05_new_boards.zip, old LCDs: hw05_old_boards.zip. The program sender.c should contain two threads. The main thread will read the text file and send comments to NUCLEO. Thread1 will wait for inputs from the user. If the user enters any command in the form of command1 or command2, or command3, thread1 will send it to NUCLEO. Otherwise, thread1 will notify the user that the input is invalid.

All the commands sent from PC to NUCLEO should be drawn in red. If the user pulls the joystick upwards, the last sent command will be redrawn with blue.

1pt for joystick

2pt for main thread

2pt for thread1

5pt for NUCLEO code for executing the received commands

courses/be5b99cpl/hw/hw05c_-_lab08.txt · Last modified: 2021/12/15 16:38 by amjadara