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
Outline the steps necessary to prepare a storage device for storing files. Identify and briefly describe the tools used to prepa
Fantom [35]

Answer:

Outline the steps necessary to prepare a storage device for storing files.

  1. Link the storage unit to a network, whether it be a laptop computer or a mobile device.
  2. Firewall it with sufficient anti-virus so that it also does not affect the linked system.
  3. The program must auto-install the storage device on the network after quarantine, and authorize it.
  4. Test the file that requires to be moved to the storage device, then upload it to the storage device after anti virus is safe.
  5. Should not directly pull the storage device out of the network, select the exit device option correctly and only then remove the device after it has been accepted.

Identify and briefly describe the tools used to prepare a storage device for storing files.

<em>EFSDump -</em> Users can share encrypted files by carrying certificates by using EFSDump. It is usually very time consuming to audit the users who have privileges. But it is very simple to list users who have access to encrypted files using EFSDump.

<em>SDelete -</em> Suppose Windows operating system eliminates the index and prevents access when we delete a file. All the same, attackers can still recover the contents of the file. Files that are encrypted by EFS leave the file behind on the disk. Using the SDelete tool we can modify free space to prevent the recovery of deleted files.

Explain why file systems are critical components of an operating system. What is their purpose?

Hypothetically defining file system is nothing more than the way files are called and logically organized for storage.

Ex: DOS, Windows, and Unix-based operating systems all contain various file systems where data is organized in tree structure.

Usually defines the naming of files, how long the suffix can be. The file system often includes a format indicating the access to a file.

Specify the file system or file systems that would be available with that operating system.

A file system controls the mechanism by which data is stored and accessed on a disk. This deals mainly with internal disk operations such as naming files, records, directories, documentation, storage management, and other protocol accesses.

  1. FAT (File Allocation Table)
  2. NTFS (New Technology File System)

Describe from an administrator perspective what is necessary to prepare a storage device for access by a user.

Connection to the storage unit is equipment-oriented. The Windows Explorer summary contains optical drives, USB keys and hard drives as separate devices, making it much easier to navigate a new computer.

To connect a Linux computer you must mount the drive by connecting it to a directory.

Usually mounting a device is a manual operation, since only the administrator determines which directory the system attaches to.

Graphical interfaces are seldom seen on Linux servers. When you plug a storage device into a USB port on your computer, nothing can happen.

Usually the mount command looks like mount/dev / sdb1/mnt, where /dev / sdb1 is the system and /mnt is the directory you want to mount it.

List a few ways that a user can utilize a file system.

System output can be improved not only by choosing the most appropriate file system(s) but also by using the various choices available for most file systems.

There are variations in the number of options depending on the specific file system, and some options can only be set at the time of development of the filesystem, even though it can be modified afterwards.

7 0
3 years ago
Step 1: Configure the initial settings on R1. Note: If you have difficulty remembering the commands, refer to the content for th
Andru [333]

Answer:

The configuration of the R1 is as follows

Explanation:

Router>enable

Router#show running-config

Router#show startup-config

Router#configure terminal

Router(config)#hostname R1

R1(config)#line console 0

R1(config-line)#password letmein

R1(config-line)#login

R1(config-line)#exit

R1(config)#enable password cisco

R1(config)#enable secret itsasecret

R1(config)#service password-encryption

R1(config)#banner motd #Unauthorized access is strictly prohibited#

R1(config)#end

R1#exit

R1>enable

R1#copy running-config startup-config

R1#show flash

R1#copy startup-config flash

3 0
3 years ago
Double bar graphs compare multiple what
GalinKa [24]
You would multiply by 2
7 0
3 years ago
Which of the following are safety guidelines when socializing online?
DochEvi [55]

Answer:

All of them execpt five and three.

Explanation:

It is okay to have social media and receive messages.

3 0
2 years ago
What is the different between the simple statement and compound statement ?​
OverLord2011 [107]

Answer:

Following is the difference between Simple and Compound statement; Simple statement (sentence) is one which has only one subject and one predicate. A Compound statement (sentence) is one which has two or more independent clauses consisting of their own subject and predicate.

Explanation:

hope it helps you

Mark as brainliest.

And follow for a follow back

4 0
3 years ago
Other questions:
  • What type of firestopping technology expands as much as 25 times in volume?
    6·1 answer
  • What aspect does not provide context in a portrait?
    10·2 answers
  • Let’s say you’re publishing a message with the Hootsuite Composer. The message contains a link to a landing page, and you want t
    9·1 answer
  • Using ________ as a promotion method will bring return visitors to your site.
    8·1 answer
  • What can happen if you do not follow the directions when cooking or baking? (Give 4 examples in a sentence each)
    8·1 answer
  • WIRELESS DATA TRANSMISSION METHODS​
    8·1 answer
  • A client is
    15·2 answers
  • When you hear the word “stress” what does it mean to you? How does stress affect you and what do you do to cope with stress
    9·1 answer
  • What can handle work that is hard on a person and could cause repetitive injuries?
    6·1 answer
  • There are two kinds of emotions: positive and negative. True False
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!