Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This short lab will allow the student to demonstrate the use of loops in basic C programming using the ATmega 3 2 8 P microcontroller

This short lab will allow the student to demonstrate the use of loops in basic C programming
using the ATmega328P microcontroller on an Arduino Uno R3 development platform.
Required Equipment
1- Laptop with functional Geany IDE, AVR toolchain and Make environment
1- Arduino Uno R31- USB Type A to B Cable
Procedure
Follow the steps below in creating your program:
Create a new folder named lab4 in your PROG1331 folder. Copy your C Source
template, makefile, and prog1331. h header into the new folder, then rename your C
Source file to:
"lastname_firstname_L4.c"
Make changes to the program flowerbox information to reflect the current file.
Ensure your template includes the AVR or C core libraries for I/O control, delay
functions, the standard I/O functions and the prog1331. h header file.
The template must also include the uart_init() function call and connect stdin and
stdout of the stdio.h header to the UART buffer locations.
Locate the pin assignment for the on-board LED of the Arduino Uno. Properly configure
the associated ATmega328P to allow control of the LED.
Create a generic structure for one of each of the following kinds of loops in the main
program while(1) loop; leave the test expressions and any other data blank for now:
a) WHILE loop
b) DO...WHILE loop
c) FOR loop.
Perform the following actions in each loop:
a) In the WHILE loop, create a serial print statement to print multiples of 5 from 0
to 100. Set up the conditions for the WHILE loop to execute the appropriate
number of times to accomplish this.
b) In the DO...WHILE loop, capture up to 3 consecutive values received from the
serial monitor (in separate variables). Print all 3 values back to the serial monitor
once the loop completes in ASCII format.
c) In the FOR loop, blink the LED on/off for 20 full cycles at a speed of 4Hz.
Send a message to the terminal indicating the program has completed. Prevent your
program from restarting after sending this message.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions