1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ANTONII [103]
3 years ago
13

Write a program in C that reads a 3-bit desired light pattern from the 3 input switches connected to pins P2.3-P2.5 and displays

the pattern on the 8 LEDs (pins P1.0-P1.7) with some ""light playing"" options based on the input from other 3 switches (pins P2.0-P2.2).
Computers and Technology
1 answer:
laiz [17]3 years ago
8 0

Answer:

Check the explanation

Explanation:

#include<stdio.h>

main()

{ int k=1,p,l,i;

int p2[8],p1[8];

for(i=0;i<8;i++){

p1[i]=0;

p2[i]=0;

}

while(k==1)

{

printf("enter the pin inputs from p2.3-p2.5:");

scanf("%d%d%d",&p2[3],&p2[4],&p2[5]);

 

printf("Press Logic 0 for on and 1 for off on switch port p2.0\n");

scanf("%d",&l);

p1[3]=p2[3];

p1[4]=p2[4];

p1[5]=p2[5];

if(l==0)

{p=1;

for(i=0;i<8;i++)

printf("p1.%d : %d\n",i,p2[i]);

printf("\n press either 1 to continue or 0 to stop :");

scanf("%d",&p);

printf("\n");

while(p==1)

{ printf("enter the pin inputs from p2.3-p2.5:");

scanf("%d%d%d",&p2[3],&p2[4],&p2[5]);

p1[3]=p2[3];

p1[4]=p2[4];

p1[5]=p2[5];

for(i=0;i<8;i++)

printf("p1.%d : %d\n",i,p2[i]);

printf("\n press either 1 to continue or 0 to stop :");

scanf("%d",&p);

printf("\n");

}

}

else

{

printf("After Rotation of pattern :\n");

for(i=0;i<8;i++)

{ if(p2[i]==0)

printf("p1.%d : 1\n",i);

else

printf("p1.%d : 0\n",i);

}

}

printf("press 0 for on and 1 for off on switch port p2.1 :\n");

scanf("%d",&l);

if(l==0)

{ printf("\nLeft Rotation of pattern from read mode :\n");

printf("p1.0 : %d\n",p1[0]);

printf("p1.1 : %d\n",p1[5]);

printf("p1.2 : %d\n",p1[6]);

printf("p1.3 : %d\n",p1[3]);

printf("p1.4 : %d\n",p1[2]);

printf("p1.5 : %d\n",p1[1]);

printf("p1.7 : %d\n",p1[6]);

printf("p1.7 : %d\n",p1[7]);

}

else

{printf("\nRight rotation of pattern from read mode: \n");

printf("p1.0 : %d\n",p1[0]);

printf("p1.1 : %d\n",p1[1]);

printf("p1.2 : %d\n",p1[2]);

printf("p1.3 : %d\n",p1[7]);

printf("p1.4 : %d\n",p1[6]);

printf("p1.5 : %d\n",p1[5]);

printf("p1.7 : %d\n",p1[4]);

printf("p1.7 : %d\n",p1[3]);

}

printf("press 0 for on and 1 for off on switch port p2.2 :\n");

scanf("%d",&l);

if(l==0)

printf("Make Rotation fast\n");

else

printf("Make Rotation slow\n");

printf("Enter 1 to continue or 0 to exit:");

scanf("%d",&k);

printf("\n");

}

}

You might be interested in
A cover letter should simply restate what is included in your résumé.<br> True<br> False
stich3 [128]
True because all resumes need a cover letter

6 0
3 years ago
Read 2 more answers
An agile team has which two characteristics? (choose two. ).
DerKrebs [107]

A SAFe Agile teams are often known to be Scrum Master and Product Owner. An Agile team characteristics are:

  • A small group typically 5 - 11 dedicated individuals who have the skills necessary to define, build, test, and deploy increments of value.

  • A group of dedicated individuals who are empowered, self-organized, self-managing, and deliver value.

A SAFe Agile team is a cross-functional group  as they are made up of about of 5-11 people who set apart, build, test, and deliver an increment of value in a short time box.

Agile team are known to be cross functional as they can define, build , test and Deploy.

See full question below

An Agile team has which two characteristics? (Choose two.)

A) A small group typically 5 - 11 dedicated individuals who have the skills necessary to define, build, test, and deploy increments of value

B) A stand-along unit of individuals who do not require input fro other teams to complete their tasks

C) A large group of individuals who all work together to create value for the client

D) A group of dedicated individuals that work in phase-gate steps to complete their PI Objectives

E) A group of dedicated individuals who are empowered, self-organized, self-managing, and deliver value

Learn more from

brainly.com/question/24390635

5 0
3 years ago
If you receive an increase in pay, how will that affect your payroll deductions?
spin [16.1K]
No it will actually help it
3 0
3 years ago
In what ways can information be slanted in a news report? List at least five ways.
Sedbober [7]

Answer:

author, journalist and speaker/media trainer this is all I know so

author, journalist and speaker/media trainer

6 0
3 years ago
Read 2 more answers
What does ' array ' mean in the context of graphics programming ?
Readme [11.4K]

Answer:

An array is a data structure that contains a group of elements. Typically these elements are all of the same data type, such as an integer or string. Arrays are commonly used in computer programs to organize data so that a related set of values can be easily sorted or searched.

3 0
3 years ago
Other questions:
  • _____ is a valuable tool that enables you to find information on the web by specifying words or phrases know as keywords- which
    14·1 answer
  • What is one important feature of an aup? 1. a list of all available courses. 2. a clear out line of the consequences of violatin
    12·2 answers
  • Cuales Son las características de la máquina analítica de Carlos Babbage ?
    11·1 answer
  • *Please* read before answering.
    14·1 answer
  • The _______ of a secondary storage device indicates how much data the storage medium can hold.
    13·1 answer
  • When parallel parking, you should select a space that is __________ as long as your car.
    11·1 answer
  • Write a method doubleUp that doubles the size of a list of integers by doubling-up each element in the list. Assume there's enou
    13·1 answer
  • Prior to the 1996 NEC, ____ receptacles and cords were permitted. However, now it is mandatory that a separate equipment groundi
    11·1 answer
  • What type of task can be defined to allow you fine-grained control over the management tasks a user can perform in an OU
    14·1 answer
  • you are setting up an active directory environment for a business that has three locations and 300 users. you want the users to
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!