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
ira [324]
2 years ago
14

Write modified code that will generate a random number between 0 and 255 when a button is pressed and will write the number to t

he serial monitor as well as to the receiver Arduino.
Computers and Technology
1 answer:
kobusy [5.1K]2 years ago
8 0

Solution :

#include<LiquidCrystal.h>

int value;

int flag;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()

{

lcd.begin(16, 2);

Serial.begin(9600);

}

void loop()

{

value=digitalRead(7);

  if(value==0){

flag=1;}

  if(value==1){

flag=~flag;}

  if (flag==1){

lcd.setCursor(0,0);    

  lcd.print("number is");

lcd.setCursor(2,1);    

lcd.print(random(0, 255));

delay(1000);

}

  else{

lcd.setCursor(0,0);

lcd.print("Not Pressed");

delay(1000);

lcd.clear();}

}

You might be interested in
Can someone please give me the 3.6 code practice answer I will mark you brainlyist
Stolb23 [73]

3.6 Code Practice Question:

Write a program to input 6 numbers. After each number is input, print the biggest of the number entered so far:

Answer:

nums = []

biggest = 0

for i in range(6):

    num = int(input("Number: "))

    nums.append(num)

    if(i == 0):

         print("Largest: "+str(nums[0]))

         biggest = nums[0]

    else:

         if nums[i]>biggest:

              print("Largest: "+str(nums[i]))

              biggest = nums[i]

         else:

              print("Largest: "+str(biggest))

                       

Explanation:

This question is answered using python

This line declares an empty list

nums = []

This line initalizes the biggest input to 0

biggest = 0

This iteration is perfoemed for 6 inputs

for i in range(6):

This prompts user for input

    num = int(input("Number: "))

This appends user input to the list created

    nums.append(num)

For the first input, the program prints the first input as the largest. This is implemented in the following if condition

<em>     if(i == 0):</em>

<em>          print("Largest: "+str(nums[0]))</em>

<em>          biggest = nums[0]</em>

For subsequent inputs

    else:

This checks for the largest input and prints the largest input so far

<em>          if nums[i]>biggest:</em>

<em>               print("Largest: "+str(nums[i]))</em>

<em>               biggest = nums[i]</em>

<em>          else:</em>

<em>               print("Largest: "+str(biggest))</em>

<em />

3 0
2 years ago
How to realize dynamic balance of planar closed-chain leg mechanism?​
Alexxandr [17]

The common belief is that Closed Chain exercises are the preferred rehabilitation for anterior cruciate ligament (ACL) injury because of increased strain.

5 0
2 years ago
Read 2 more answers
Pls help. will give brainliest to FIRST and CORRECT answer!
Zolol [24]

Answer:

All of the above

Explanation:

7 0
2 years ago
Which act requires enterprises to guard protected health information and implement policies and procedures to safeguard it?
bogdanovich [222]

Answer:

D. HIPAA (Health Insurance Portability and Accountability Act)

Explanation:

HIPAA which stands for Health Insurance Portability and Accountability Act, is an act designed by the US government in 1996 to guard patients' confidential health information and also implement policies and procedures to safeguard it. The act contains the required information and instruction for handling patients' medical health information. The law however gives patients (or their representatives) the right to access these information which as a matter of fact must be made available within 30 days from the day of request.

PS: Not sure why the option D in the question contains ' FTF '. I have taken it to be a typo because without it, the option is in itself complete.

7 0
3 years ago
The ______ manages the hardware components including the cpu, memory storage, and peripheral devices. options operating system d
Alexandra [31]
The answer is the os or operating system
8 0
2 years ago
Other questions:
  • You want to use a wireless keyboard and mouse with your laptop computer. which method should you use
    11·1 answer
  • 2. Suppose you want to write a method that prints a heading on a new output page, along with a page number that is 1 in the firs
    15·1 answer
  • I need le help, darn ijourneys
    10·2 answers
  • Converting Denary to Binary
    15·1 answer
  • Which is the purpose of adding B-Roll footage to a sequence?
    10·1 answer
  • I need a utube name for a gaming channel....PLEASE HELP...BRAINLIEST
    5·1 answer
  • Some people recommend deleting social media accounts because of the troubling legal and ethical implications of social media. Do
    9·1 answer
  • Help pweeze this is due today :(<br><br> I will give u brainliest just pweeze, I need this answer :(
    8·1 answer
  • Im a beginner programmer. what languages should i learn and how do i get better
    13·1 answer
  • 3. is the system of rules that govern the ordering of values? culture a. Ethics b. organization c. protocol d. value system 3 .
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!