Write your own printArray() function found in Processing for the Arduino. For simplicity, you can limit printArray() to integer arrays and you will also pass the size of the array to your function. For example, given the following code:

int terps[5] = {7, 9, 12, 1, 46};
void printArray(int arrayToPrint[], int arraySize) { // YOUR CODE HERE }
void setup()
{ // put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
printArray(terps,sizeof(terps)/sizeof(int)); delay(1000);
}

You should repeatedly see the following in the serial monitor:

[0]: 7
[1]: 9
[2]: 12
[3]: 1
[4]: 46

Answers

Answer 1

Answer:

Follows are the method definition to this question:

void printArray(int arrayToPrint[], int arraySize) //defining a method printArray that accepts two array in its parameters

{

for (int j = 0; j < arraySize; j++)//defining for loop print Serial numbers

{

Serial.print("[");//use print method to print square bracket

Serial.print(j);//use print method to print Serial numbers

Serial.print("]: ");//use print method to print square bracket

Serial.println(arrayToPrint[j]);//printing array value

}

}

Explanation:

In the above code, a method "printArray" is declared that holds two arrays "arrayToPrint and arraySize" as a parameter, and inside the method is used for loop to print the values.

In the loop, first, it uses the square bracket to print the serial number and in the last step, it prints array values.


Related Questions

Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer's monthly bill. It should ask which package the customer has purchased and how many hours were used. It should then display the total amount due. Input Validation: Be sure the user only selects package A, B or C. Also, the number of hours used in a month cannot exceed 744. Use switch.

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int hour; char pkg; float bill = 0;

   cout<<"Package: "; cin>>pkg;

   cout<<"Hour: "; cin>>hour;

   if(hour<=744 && hour >=0){

       switch (pkg) {

           case 'A':

               bill = hour * 9.95;

               if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}

           break;

           case 'B':

               bill = hour * 14.5;

               if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}

           break;

           

           case 'C':

               bill = 19.95;

           break;

           

           default:

               cout << "Package must be A, B or C";}

cout<<"Total Bills: $"<<bill; }

else{ cout<<"Hour must be 0 - 744"; }

return 0;

}

Explanation:

This declares all variables:    int hour; char pkg; float bill=0;

This prompts the user for package type:  cout<<"Package: "; cin>>pkg;

This prompts the user for number of hours:    cout<<"Hour: "; cin>>hour;

This checks if hour is between 0 and 744 (inclusive)

   if(hour<=744 && hour >=0){

If true, the following is executed

A switch statement to check valid input for package

       switch (pkg) {

For 'A' package

           case 'A':

Calculate the bill

               bill = hour * 9.95;

               if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}

End of A package:            break;

For 'B' package

           case 'B':

Calculate the bill

               bill = hour * 14.5;

               if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}

End of B package:            break;

For C package            

           case 'C':

Calculate bill:                bill = 19.95;

End of C package:            break;

If package is not A, or B or C

           default:

Prompt the user for valid package                cout << "Package must be A, B or C";}

Print total bills: cout<<"Total Bills: $"<<bill; }

If hour is not 0 to 744: else{ cout<<"Hour must be 0 - 744"; }

lower cabinet is suitable for storing and stocking pots and pans true or false​

Answers

True.
Make sure cabinet is clean enough to put the pots and pans.

What are the three types of networks?
A) Internet, PowerPoint, Excel
B) Internet, LAD, WAN
C) Internet, WAN, LAN
D) None of the above

Answers

Answer:

Local Area Network (LAN)

Metropolitan Area Network (MAN)

Wide area network (WAN)

(So C, I'm pretty sure.)

Answer:

LAN,MAN,WAN

Explanation:

are the three types of network

____________ reference is used when you want to use the same calculation across multiple rows or columns.

Answers

Answer:

relative cell

Explanation:

So, if you want to repeat the same calculation across several columns or rows, you need to use relative cell references. For example, to multiply numbers in column A by 5, you enter this formula in B2: =A2*5. When copied from row 2 to row 3, the formula will change to =A3

Answer:

Relative

Explanation:

Relative  reference is used when you want to use the same calculation across multiple rows or columns.

Have you ever tried using such a camera?​

Answers

Answer: yeah i mean i use my canon camera

Explanation:

Explanation historical development of computer ​

Answers

Answer:

Brief History Of Computer. The computer as we know it today had its beginning with a 19th century English mathematics professor name Charles Babbage. ... Other developments continued until in 1946 the first general– purpose digital computer, the Electronic Numerical Integrator and Computer (ENIAC) was built.

Explanation:

Computers and electronics play an enormous role in today's society, impacting everything from communication and medicine to science.

Although computers are typically viewed as a modern invention involving electronics, computing predates the use of electrical devices. The ancient abacus was perhaps the first digital computing device. Analog computing dates back several millennia as primitive computing devices were used as early as the ancient Greeks and Romans, the most known complex of which being the Antikythera mechanism. Later devices such as the castle clock (1206), slide rule (c. 1624) and Babbage's Difference Engine (1822) are other examples of early mechanical analog computers.

The introduction of electric power in the 19th century led to the rise of electrical and hybrid electro-mechanical devices to carry out both digital (Hollerith punch-card machine) and analog (Bush’s differential analyzer) calculation. Telephone switching came to be based on this technology, which led to the development of machines that we would recognize as early computers.

The presentation of the Edison Effect in 1885 provided the theoretical background for electronic devices. Originally in the form of vacuum tubes, electronic components were rapidly integrated into electric devices, revolutionizing radio and later television. It was in computers however, where the full impact of electronics was felt. Analog computers used to calculate ballistics were crucial to the outcome of World War II, and the Colossus and the ENIAC, the two earliest electronic digital computers, were developed during the war.

With the invention of solid-state electronics, the transistor and ultimately the integrated circuit, computers would become much smaller and eventually affordable for the average consumer. Today “computers” are present in nearly every aspect of everyday life, from watches to automobiles.

The history of computers is one that began far back 2000 years ago in the city of Babylonia where there was the use of  abacus and it has grown to now the use of digital computer as it start in 1642. ​

What is  the history of computer?

The history of computers is one that is more than 200 years but in the 19th century, there was the invention of  mechanical calculating machines.

Note that the The 1st generation of computers was said to have existed from the year 1940 to 1955 and now it has grown to a whole new level.

Learn more about computer from

https://brainly.com/question/24540334

#SPJ9

Binary is a base-2 number system instead of the decimal (base-10) system we are familiar with. Write a recursive function PrintInBinary(int num) that prints the binary representation for a given integer. For example, calling PrintInBinary(5) would print 101. Your function may assume the integer parameter is non-negative. The recursive insight for this problem is to realize you can identify the least significant binary digit by using the modulus operator with value 2. For example, given the integer 35, mod by 2 tells you that the last binary digit must be 1 (i.e. this number is odd), and division by 2 gives you the remaining portion of the integer (17). What 's the right way to handle the remaining portion

Answers

Answer:

In C++:

int PrintInBinary(int num){

if (num == 0)  

 return 0;  

else

 return (num % 2 + 10 * PrintInBinary(num / 2));

}

Explanation:

This defines the PrintInBinary function

int PrintInBinary(int num){

This returns 0 is num is 0 or num has been reduced to 0

if (num == 0)  

 return 0;  

If otherwise, see below for further explanation

else

 return (num % 2 + 10 * PrintInBinary(num / 2));

}

----------------------------------------------------------------------------------------

num % 2 + 10 * PrintInBinary(num / 2)

The above can be split into:

num % 2 and + 10 * PrintInBinary(num / 2)

Assume num is 35.

num % 2 = 1

10 * PrintInBinary(num / 2) => 10 * PrintInBinary(17)

17 will be passed to the function (recursively).

This process will continue until num is 0

You should write the client so that it sends 10 ping requests to the server, separated by approximately one second. Each message contains a payload of data that includes the keyword PING, a sequence number, and a timestamp. After sending each packet, the client waits up to one second to receive a reply. If one second goes by without a reply from the server, then the client assumes that its packet or the server's reply packet has been lost in the network.Hint: Cut and paste PingServer, rename the code PingClient, and then modify the code. The two programs follow very similar process.You should write the client so that it starts with the following command:java PingClient host portwhere host is the name of the computer the server is running on and port is the port number it is listening to. Note that you can run the client and server either on different machines or on the same machine.The client should send 10 pings to the server. Because UDP is an unreliable protocol, some of the packets sent to the server may be lost, or some of the packets sent from server to client may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply; if no reply is received, then the client should assume that the packet was lost during transmission across the network. You will need to research the API for DatagramSocket to find out how to set the timeout value on a datagram socket.When developing your code, you should run the ping server on your machine, and test your client by sending packets to localhost (or, 127.0.0.1). After you have fully debugged your code, you should see how your application communicates across the network with a ping server run by another member of the class.Message FormatThe ping messages in this lab are formatted in a simple way. Each message contains a sequence of characters terminated by a carriage return character (r) and a line feed character (n). The message contains the following string:PING sequence_number time CRLFwhere sequence_number starts at 0 and progresses to 9 for each successive ping message sent by the client, time is the time when the client sent the message, and CRLF represent the carriage return and line feed characters that terminate the line.

Answers

Answer:

figure it out urself

Explanation:

Methods ii.) Define and implement a method that takes a string array as a parameter and returns the length of the shortest and the longest strings in the array i.) Write a method that take an integer array as a parameter and returns the sum of positive odd numbers and sum of positive even numbers. iii.) Implements the sequential search method that takes and array of integers and the item to be search as parameters and returns true if the item to be searched in the array, return false otherwise

Answers

Answer:

Explanation:

Well I am sorry I don't know the answer anyway.

2. It is the art of creating computer graphics or images in art, print media, video games.
ins, televisions programs and commercials.

Answers

the answer is CGI :)

which internet service is the main reason the internet has expanded and what draws newcomers to the internet?

Answers

Answer:

It has spread throughout the world since it is a very useful tool since most things are facilitated, thus leading to a much more efficient daily life, which is why the internet is one of the main means for the functioning of the world today. day, as new technologies have revolutionized

Social media.

The term social media refers to those digital tools that facilitate the transmission of information, communication and social interaction between individuals. Thus, social media allows individuals to relate to each other, in a similar way as if they were physically interacting, but through computer means.

These social media can be from profiles on social networks to blogs, podcasts or even videos on digital platforms. In short, nowadays social media is an integral part of people's social life, and it is in many cases what ends up driving them to use the internet.

Learn more in https://brainly.com/question/21765376

Other Questions
14. If 100 grams of sodium nitrate are dissolved in 100 grams of waterat 60 degrees C, is the solution formed saturated, unsaturated, orsupersaturated? The angles of quadrilateral are in the ratio 3 : 5 : 9 : 13. Find all the angles of the quadrilateral. How does the first sentence of the second paragraph affect the reader's understanding of the rest of the passage? A. It gives just enough information to make the reader want to keep reading. B. It shows the reader that we have been unable to understand popcorn until today. C. It prepares the reader to think about what makes a kernel of popcorn pop. D. It explains how popcorn pops so the reader knows it is not the result of angry gods.Reset Next Question Our environment is very sensitive to the amount of ozone in the upper atmosphere. The level of ozone normally found is 6.0 parts/million (ppm). A researcher believes that the current ozone level is not at a normal level. The mean of 13 samples is 5.6 ppm with a variance of 0.49. Assume the population is normally distributed. A level of significance of 0.1 will be used. Find the value of the test statistic. Round your answer to three decimal places. 4.Sarah, Toby, and their mother run an online store called Unique Bracelets that sells handmade bracelets consisting of unique, individually-painted charms. Each bracelet they sell consists of 12 small charms and 5 large charms. Each order also gets 5 blank spacer charms to use to separate charms or fill in the bracelet. They do not sell charms separately and do not sell bracelets in parts. (f)Write an equation showing the number of charms, y, needed for x bracelets purchased in an order. Describe what the equation means in a real-world context. in angle abcd if b=50 find the other angles find the area of given figure Which of the following statements regarding adoption studies is false?A.Adopted children show some similarity in IQ scores.B.Siblings raised together have higher similarities in IQ than children raised apart.C.Unrelated children raised together show significant resemblance in IQ.D.In all instances, adopted children show higher IQ similarities than related children.Please select the best answer from the choices providedABCD 8. Find 51% of 140. Round to the nearest tenth if necessary.0 274.50 7,140.00 71.40 1.4 Helpppppppp pls help . Question below. Write an equation. Item 11Write and solve an equation to answer the question.91 is 130% of what number w? Find the value of xx 66117 The role of the institutional animal care and use committee (IACUC) of a research institution is to provide research animals with clean and healthy conditions in the laboratory. mediate the acquisition of animals by the institution's researchers. review all proposals for animal research to be sure the procedures to be used are appropriate and humane. review animal research proposals only to ensure that the proposed experiments are scientifically valid. Help please and tysm6 x (5 + 4) - 3 - (2+1)A 18B) 30C) 48D) 54 Is this a proportion? 1.44/8 = 1.7/10 I need help on these questions please. (English village)( shopping centre) (souvenir shop) (city tour) are they compound nouns? Dave M. Company issues 500 shares of $10 par value Common Stock and 100 shares of $40 par value Preferred Stock as a basket for a lump sum of $105,000. Total transaction costs paid to complete the sale was $5,000. Common Stock of the company was selling for $198 per share in the market that day and Preferred Stock was selling for $110 per share in the market that day.Required:a. Prepare a table showing how the sale price is allocated between the Common Stock and the Preferred Stock.b. Prepare the journal entry to record the basket sale of the two stocks. Help I will be marking brainliest!!!!A. 274B. 300C. 306D. 316