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]
3 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]3 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
Convert the decimal number -17 to binary (2's complement)
Katarina [22]

Answer:

1111111111101111

Explanation:

The binary representation of 17 is 0000000000010001.

In order to get the binary representation of -17 we need to calculate the 2's complement of 0000000000010001.

Step 1 : 1s complement of 0000000000010001 = 1111111111101110

Step 2 : 2s complement => 1111111111101110 + 1 = 1111111111101111

This actually corresponds to the negative of the original number which was 17.

So the 2s complement representation of -17 is 1111111111101111 .

6 0
4 years ago
Please construct a program that reads the content from the file numbers.txt. There are two lines in the file, each is an integer
Mademuasel [1]

Answer:

file = open("numbers.txt")

numbers = []

for line in file:

   numbers.append(int(line))

print("The numbers in the file: " + str(numbers[0]) + " " + str(numbers[1]))

print("The sum of the numbers: " + str(numbers[0] + numbers[1]))

Explanation:

The code is in Python.

Open the file named numbers.txt

Create an empty list, numbers, to hold the numbers in the file

Create a for loop that iterates through file and adds the number inside the file to the list

Print numbers

Calculate and print the sum of the numbers

5 0
4 years ago
If your Word page is visually confusing after combining documents, one way to simplify the page is to select Hide Source Documen
FrozenT [24]
I’m not really sure but I’ll T
6 0
4 years ago
(50 POINTS) A folder has been shared with other users and set to read-only. What does this mean for users?
kobusy [5.1K]
I believe it would be “users cannot add new folders or files” i think they can only read what’s in the folder.
8 0
3 years ago
Read 2 more answers
If an LED had power rating of 150 milliwatts at 1.5 volts , how much current is used
Lana71 [14]

The relation between Power, Current and Voltage is given as:

      P = V i

where P is Power in Watts,

V is Voltage in Volts,

and i is Current in Ampere.


We are given:

Power = 150 milliwatts = 0.15 Watts

(as 1 milliwatt = 0.001 Watts)

Voltage = 1.5 volts

and we need to find the current.


Hence using above equation:

P = V i

i = \frac{P}{V}

i = \frac{0.15}{1.5}

i= 0.1 Ampere


Answer:

The current used is 0.1 Ampere

8 0
3 years ago
Other questions:
  • ?the single most effective security measure for digital devices is to password protect access to them.
    5·1 answer
  • Quien invento el primer vehiculo con motor?
    15·2 answers
  • A technician needs to be prepared to launch programs even when utility windows or the Windows desktop cannot load. What is the p
    11·1 answer
  • What term describes a wireless network topology in which access points work as peer devices on the same network?
    14·1 answer
  • Write a method public static ArrayList merge(ArrayList a, ArrayList b) that merges two array lists, alternating elements from bo
    14·1 answer
  • To convince the server that a user is authentic, the authentication server creates a _________ that contains the user's ID and n
    13·1 answer
  • Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times
    8·1 answer
  • Take points for free who are new and enjoye them
    9·2 answers
  • Select the correct answer.
    6·2 answers
  • In programming 5/2 is an example of what math?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!