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

Question DetailsNormal
$ 32.00

COSC130 Fall 2015 Lab 3 | Complete Solution

Question posted by
Online Tutor Profile
request

COSC130 Fall 2015 Lab 3 (100 pts)
MGT JA Rev2F2015


This lab continues your work with sketches for the Due board. You will use code downloaded from
Blackboard, including a function to drive the Shield's 7-segment displays. The downloaded code is the skeleton you start with, but you will modify this code to create an up-down counter. You'll also implement a simple calculator.
There is no new reference handout for this lab. The previous Part I and Part II are relevant material. This lab has two parts. The point distribution is described at the end.

1 Creating an Up-Down Counter
You must create a simple sketch that counts up/down in the decimal range 0-9 (binary integer range 0000- 1001) and displays the current decimal count on a 7-segment display. The Serial Monitor is not required on this part, but it may help your debugging.

1. Download the skeleton sketch UDCounter.ino from Blackboard. This sketch handles the 7-segment display for you by the function Drive7(). When you input an integer in the range 0-9, it'll display on
a 7-segment display. Do not modify this code except in the locations where it asks you to do so.
2. Open UDCounter in IDE and modify the sketch for these requirements:
(a) The current count is an integer in the range 0-9 and is shown on a 7-segment display. The initial
count is 0.
(b) When Shield button A1 is brie
y pressed, the counter increments by 1.
(c) When Shield button A2 is brie
y pressed, the counter decrements by 1.
(d) When Shield button A3 is brie
y pressed, the counter resets to 0.
(e) The count is circular. When the count is 9 and button A1 is pressed, the count \goes up" to 0.
When the count is 0 and button A2 is pressed, the count \goes down" to 9.
(f) The count should change only once when a button is pressed. For instance, if button A1 is held
down, the count does not keep increasing.
(g) You may assume that only one button is pressed at a time.
2 Creating a Simple Calculator
You will write a sketch using the Serial Monitor for I/O to implement a simple calculator in this second
part of the lab. The requirements are:
1. Name your sketch CalcYourName using a short version of your own name for YourName.
2. The user will type-and-Send a one-line input from the Serial Monitor. The form of a correct input
is
operand1 operator operand2
with a space between items, or a single operand
1
operand1
Three examples of correct input are 5.5 * 6 and -5.5 * -6 and -5.5.
3. Any other form of input is incorrect. The sketch must detect incorrectness and print an error message
on the Serial Monitor. It's a good idea to keep messages to the user polite.
Examples of incorrect input are -5.5 -6 * (operator is in wrong place) and (5) * 6 (the parens
aren't allowed).
4. Your calculator must handle the four operators + - * /.
5. Input operands are decimal (base-10).
An operand is an integer (a sign is allowed) or a real number written as integer-decimal-fraction,
for instance, 25.1; however, the calculator must retain the previously computed answer and if the user
uses ans for an operand, the calculator must use that previously computed value as an operand.
For example, 5 * 2 computes and retains answer 10, so ans * 3 next computes and retains new answer
30.
Initialize ans to 0.
6. Your calculator sketch prints the correct answer in the Monitor. Remember that the Monitor prints
floats rounded to two fractional digits, so that's how your calculator's answer will be displayed.
7. If the user types-and-Sends just one operand, that's OK. Your calculator will just make that operand
the answer and echo it back to the Serial Monitor. For example, the input -5.5 is allowed and the
value of ans becomes -5.5.
Points: Demo and Submit on Blackboard
1. Demo your modi ed UDCounter sketch to GTA in this lab session (anytime before the session is over)
and submit sketch on Blackboard by deadline below (50 pts).
2. Demo your CalcYourName sketch to GTA in this lab session and submit sketch on Blackboard by
deadline below (50 pts).
All items must be submitted on Blackboard by 11:59pm on R 17 Sept 2015.
 

Available Answer
$ 32.00

[Solved] COSC130 Fall 2015 Lab 3 | Complete Solution

  • This Solution has been Purchased 1 time
  • Submitted On 10 Sep, 2015 07:13:53
Answer posted by
Online Tutor Profile
solution
Function: drive7(int val) Description: drive7 takes a value fro...
Buy now to view the complete solution
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