Real-Time Embedded Processor Systems ACOE343 Experiment #6

Total Page:16

File Type:pdf, Size:1020Kb

Real-Time Embedded Processor Systems ACOE343 Experiment #6

Real-Time Embedded Processor Systems – ACOE343 – Experiment #6

Department of Computer Science and Engineering

Real-Time Embedded Systems Laboratory (ACOE343)

Laboratory Exercise #6

Serial communication with Arduino

Student’s Name: Semester: Date:

Assessment: Assessment Point Weight Grade Methodology Presentation and discussion of results Participation Assessment Points’ Grade

Comments: Real-Time Embedded Processor Systems – ACOE343 – Experiment #6

Lab #6: Serial communication with Arduino

Procedure: In this lab you will need two Arduinos and two PCs!

Step 1: Connect two Arduino Boards through the serial bus by connecting the first Arduino TX pin to the second Arduino RX pin and vice versa. Connect the GND pins of the two Arduinos together through a wire for a common ground.

Step 2: Write a program for the first Arduino (Lab6a1) that sends a “Hello world!” string from the first Arduino to the second, and a program for the second Arduino (Lab6a2) that receives the string and prints it on the Serial monitor. Don’t forget to initialize the serial connection with Serial.begin(); Use the following functions and variables for your program: char txstr[] = "…"; //String data Serial.write(txstr, int length); //Write the serial data, wher length the length of the string char rxstr[]; //Initialized variable to store received data Serial.readBytes(rxstr, int length); //Read the serial data and store in var rxstring where int the length of the string

Insert code here....

Step 3: Compile the program (From the “Sketch” menu select “Verify/Compile”). If the compiler shows any errors, correct them and re-compile the program.

Step 4:  Select "Tools=> Board=> Chipkit MAX32""  Select "File=>Upload to I/O Board".  Wait until you see a "Done uploading" message. An LED in the shield should be flashing.

Question 1

What is the size of each program in bytes? Real-Time Embedded Processor Systems – ACOE343 – Experiment #6

Step 5: Write a program (Lab6b) for each Arduino that reads the temperature sensor and sends the temperature to the other Arduino. Both Arduinos, after receiving each other’s temperature, compare it with their own, and print on the serial monitor which temperature is higher. The sampling interval is one second.

Step 6: Compile the program (From the “Sketch” menu select “Verify/Compile”). If the compiler shows any errors, correct them and re-compile the program.

Step 7:  Select "Tools=> Board=> Chipkit MAX32""  Select "File=>Upload to I/O Board".  Wait until you see a "Done uploading" message. An LED in the shield should be flashing.

Insert code here....

Question 2

What is the size of the Lab3b program in bytes?

Recommended publications