Question

Please clearly show and explain how I am to do this: Using TinkerCad or the Arduino...

Please clearly show and explain how I am to do this:

Using TinkerCad or the Arduino kit, create a circuit using a keypad and one 7-segment display. When you press any key on the keypad it must be displayed on the 7-segment display. Due to the limited number of pins on the Uno (TinkerCad) you must use the Analog Pins as Digital inputs.

Homework Answers

Answer #1

Code

#include<Keypad.h>

#define KEY_ROWS 4
#define KEY_COLS 4

char keymap[KEY_ROWS][KEY_COLS]={
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}, 
};

byte colPins[KEY_COLS]={A0,A1,A2,A3}; //Initialising all the required pins
byte rowPins[KEY_ROWS]={0,4,2,3};

Keypad myKeypad = Keypad(makeKeymap(keymap),rowPins,colPins,KEY_ROWS,KEY_COLS); //Calling the Keypad class from the librrary
void setup()
{
  Serial.begin(9600);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(5, OUTPUT);
}

void loop()
{
  char key = myKeypad.getKey(); //This gets the inputed charachter from the keypad
  
  if (key=='0')    //It goes through a series of if statements to check which is the clicked button and lights up the seven segment display accordingly
  { 
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, LOW);
    
  }
  
  if (key=='1')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
    digitalWrite(11, LOW);
    digitalWrite(12, LOW);
    
  }

  if (key=='2')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, LOW);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='3')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
    digitalWrite(11, LOW);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='4')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='5')
  {
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    digitalWrite(5, LOW);
  }
  
  if (key=='6')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='7')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
    digitalWrite(11, LOW);
    digitalWrite(12, LOW);
    
  }
  
  if (key=='8')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
   
  }
  
  if (key=='9')
  {
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='A')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
   
  }
  
  if (key=='B')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='C')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, LOW);
    
  }
  
  if (key=='D')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, LOW);
   
  }
  
  if (key=='*')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(12, HIGH);
    
  }
  
  if (key=='#')
  {
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
    digitalWrite(11, LOW);
    digitalWrite(12, HIGH);
    
  }
}

Circuit Diagram

Code is explained in Comments please comment if more information is needed.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design the following synchronous counters (one at a time) using the 7493 IC. Show all your...
Design the following synchronous counters (one at a time) using the 7493 IC. Show all your connections clearly (use Multisim). Show the connections to pins R0 (1) and R0 (2) so that you can get each of the following: Mod 10 counter, Mod 12 counter and Mod 15 counter. You must use a BCD decoder (74LS47N), resistors, and a seven-segment display
Design the following synchronous counters (one at a time) using the 7493 IC. Show all your...
Design the following synchronous counters (one at a time) using the 7493 IC. Show all your connections clearly (use Multisim). Show the connections to pins R0 (1) and R0 (2) so that you can get each of the following: Mod 10 counter Mod 12 counter Mod 15 counter You must use a BCD decoder (74LS47N), resistors, and a seven-segment display
Show Work In this lab, you will make a digital thermometer using the SEN-11931 breakout board...
Show Work In this lab, you will make a digital thermometer using the SEN-11931 breakout board as well as the 4-bank seven-segment LED display. Design the hardware connection of the SEN-11931, reuse the 4-bank 7-segment LED connection from Lab 4 for the mbed to read the temperature from the SEN-11931 and display the temperature in Fahrenheit degrees on the LED display in the format of xxx.x. Build your circuit and include all the required information about your hardware design in...
*Please show your work. I do not understand how to do it* The two-way table below...
*Please show your work. I do not understand how to do it* The two-way table below summarizes how students performed in several sections of MAT 152 on the Unit 2 Test in previous semesters. The row labels are letter grades. The column labels describe whether or not a student completed all chapter quizzes for the unit (first column), or missed at least one quiz for the unit (second column). Completed all quizzes Missed at least one quiz Total A 19...
I am trying to make a program in C# and was wondering how it could be...
I am trying to make a program in C# and was wondering how it could be done based on the given instructions. Here is the code that i have so far... namespace Conversions { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if...
Hello, I am trying to do a critical analysis of the article below using economic or...
Hello, I am trying to do a critical analysis of the article below using economic or microeconomic concepts and tools. Please can you read the article and tell me the key ideas of the article that can be helpful and the concepts ( or themes) on microeconomic that I can use to do the critical analysis of those ideas? Thanks Economists Worry a Trade War Could Derail U.S. Growth Forecasters surveyed by The Wall Street Journal predict healthy growth in...
Prepare, in good form, a Sales Budget, and Production Budget. Please show work. I am just...
Prepare, in good form, a Sales Budget, and Production Budget. Please show work. I am just trying to make sure I have the correct answers. Balance Sheet Bottas Manufacturing, Inc. Balance Sheet December 31, 2018 ASSETS Cash $           25,711.00 Marketable securities                20,000.00 Accounts receivable             565,844.43 Inventories:    Finished goods $           86,385.60    Work in process                          0.00    Direct materials                  7,193.94                93,579.54 Total Current Assets             705,134.97 Property, plant and equipment $         844,200.00    Less: Accumulated...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following...
1. Vim commands: a. How do you auto indent your program? b. Explain what the following commands do: dd, y3, p, :set cindent (1 pt) VIM exercises These exercises on the computer need to be repeated by each student in the pair. This is to ensure that both students understand how to get around in Linux!!! For this part of the lab, you will create a .vimrc file that will help you develop your C++ programs using VIM. First, we...
Project Update 1 please just this question Write up to a 1/2 page on where you...
Project Update 1 please just this question Write up to a 1/2 page on where you are at on your ethics project Attached is my project, and I am using walmart. Please just do the half page summary.. the below is just my outline of what I will have due later. COMPANY PROJECT BUS 285 You are to analyze a company of you chose in the Orientation assignment. Your project must include the following sections, and at a minimum address...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT:...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT: FEASIBILITY STUDY USING CVP ANALYSIS S. K. Mitra and Shubhra Hajela wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be transmitted, photocopied, digitized or otherwise reproduced in any...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT