Cash-back offer from April 23rd to 27th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 25.00

COSC130 Fall 2015 Lab 2 100% Satisfaction Guaranteed!

Question posted by
Online Tutor Profile
request

COSC130 Fall 2015 Lab 2 (100 pts; 10 pts extra credit)
MGT JA Rev1F2015

This lab is about using an IDE utility called the Serial Monitor. The Monitor is a convenient way to
monitor data communications between IDE and your Due board in real time while your uploaded sketch is running on the ARM microcontroller. Fig. 1 shows the Serial Monitor window that opens on your computer when you start the Monitor in IDE.
The reference handout Intro to COSC130 Labs Using Arduino Due Board and IDE, Part II
gives you an intro to the Serial Monitor before your lab session.

COM7 X
Send
Autoscroll No line ending 9600 baud
Newline char NL sent at end of your char(s)
Carriage return char CR sent at end of your char(s)
data coming back from
use functions such as
Due board when you
between the Serial Monitor and the Due board (the info format
No line ending (only your char(s) are sent)
Click to Send the
line of char(s) you
when you click on Send:
Your option for the Serial Monitor
typed over the USB
cable to the Due
Move your cursor
to this bar and type
Info about the serial data communication channel
board.
depends on the Operating System Windows/Mac OSX/Linux).
Both NL and CR sent at end of your char(s).
in yout sketch.
Be sure this number agrees
using the function call
Serial.begin(9600);
with the rate (bps) you set up
in your sketch.
line of char(s) to send
This window displays
Click to close the
Serial Monitor.
to the Due board.
Serial.print(data)
Figure 1: IDE Serial Monitor window.
This lab is about the Arduino IDE Serial Monitor. Look at the end for the points distribution.
1 Serial Monitor Examples from the Reference Handout
Having read the reference handout as required, you have an idea of how the Serial Monitor works and how
to use it.
1.1 An Example from the Reference Handout
This example sketch is in the handout.
1. Start IDE.
2. Edit the BareMinimum sketch to create the following real sketch. It's small, so type it yourself.
1
char RI;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
RI = Serial.read();
Serial.println(RI);
}
}
3. Run IDE Verify/Compile. If you made any errors, correct them. How many bytes is your compiled
code?
4. Upload and start the Serial Monitor with option No line ending. Type-and-Send several chars.
Does it work as you expected? If not, explain what's unexpected.
5. There are two questions at the end of this Serial Monitor example in the reference handout. Answer
them.
1.2 Another Example from the Reference Handout
Another example is a version of an early lab in COSC102 at UTK concerning a number of coins and a total
amount in cents.
1. Download the sketch COSC102.ino from Blackboard.
2. The reference handout describes what this sketch does. Analyze the sketch and be sure you understand
each instruction.
3. Open COSC102 as an IDE sketch. Run Verify/Compile. There shouldn't be any errors.
4. Upload and test the sketch by using the Serial Monitor for I/O.
2 Printing ASCII
2.1 The Arduino Example Sketch
The sketch ASCIITable is in 04.Communication in IDE File/Examples. This sketch prints out byte values
in the Serial Monitor window in several formats for each \visible ASCII." For instance, a space doesn't
print as visible on a standard display.
1. Start IDE. Navigate to File to Examples to 04.Communications. Click on ASCIITable to open that
sketch.
2. Upload and start the Serial Monitor to see how the sketch displays its output on the Monitor.
3. Take a screenshot of the printed ASCII table, write your name on it, and give it to GTA by the end
of your lab session.
2
Figure 2: Example output (Mac OSX screen shown).
2.2 Print an ASCII value yourself
The sketch ASCIITable prints an entire table of visible ASCII. You will write your own sketch to print
visible ASCII in decimal for an input char that the user types-and-Sends from the Serial Monitor. Fig. 2
illustrates what the Monitor display should look like.
Requirements:
1. Name your sketch Lab2.
2. Your sketch accepts only visible ASCII. It turns out that the ASCII visible on a standard display is the
decimal range [33,126]. Examples of nonvisibles are space, CR, NL having respective decimal ASCII
32, 13, 10.
3. If the user types-and-Sends nonvisible, the sketch prints an error message on the Monitor.
4. The user must send a single visible at a time. The sketch prints an error message if the user sends a
line of more than one byte (visible or not).
5. The sketch handles a total of 100 visibles sent from the Monitor. When this limit has been reached,
the sketch displays a message that no more input is allowed.
Hints:
1. You can use a character array (a string of chars) to store the visibles that have been printed.
2. You can use the Arduino function Serial.readBytesUntil() to read from the serial bu er. It's
documented at
https://www.arduino.cc/en/Serial/readBytesUntil
3. Remember that \visible ASCII" is in the decimal range [33,126]. Any ACSII outside that range is
code for a nonvisible item. For example, ASCII 127 is DEL (delete) which isn't a visible character on a
standard display.
3
2.3 10 pts Extra Credit
Create a function that converts ACSII to the char it represents and prints it.
1. Your sketch only accepts \visible ASCII" and returns an error message for any illegal input.
2. The user types-and-Sends an input line from the Serial Monitor such as A97 standing for \ASCII
decimal 97". Decimal 97 is ASCII for a, so your sketch must print the char a on the Monitor.
Points: Submit on Blackboard
1. For convenience in submitting on Blackboard, just put your answers to the reference handout questions as comments at the start of your sketch Lab2 (20 pts).


2. Submit your sketch named Lab2 (60 pts).
Also give screenshot of ASCIITable to GTA (20 pts). Be sure to write your name on it for credit.
Optional: Demo the extra credit function to GTA in lab (10 pts).
Items must be submitted on Blackboard by 11:59pm on R 10 Sept 2015 (by midnight on R before your next F lab session).

Available Answer
Other Similar Questions
User Profile
NUMBE...

COSC130 Fall 2015 Lab 2 100% Satisfaction Guaranteed!

COSC130 Fall 2015 Lab 2 (100 pts; 10 pts extra credit) MGT JA Rev1F2015 This lab is about using an IDE utility called the Serial Monitor. The Monitor is a convenient way to monitor data communications between IDE and your Du...
User Profile
Exper...

COSC130 Fall 2015 Lab 2 | Complete Solution

This Tutorial is rated A+ previously,if you have any questions regarding this tutorial then you can contact me....
User Profile
AceTu...

COSC130 Fall 2015 Lab 3 | Complete Solution

Function: drive7(int val) Description: drive7 takes a value from 0-9 and displays it on the 3rd segment of the seven-segment display. Arguments: int value -- An integer in the range [0-9]. A value outside of this range wil...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35