Question

Write the following using C language for program in Arduino: Write a program that turns on...

Write the following using C language for program in Arduino:

  • Write a program that turns on first LED for one second, then first LED off, wait for one second, then second LED turns on for one second, then goes off, wait for one second, keep going for third and fourth LEDs, and the program repeats until power is cut or new program uploaded.

Homework Answers

Answer #1

const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
const int led4 = 5;


void setup() {
  
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);

}

void loop() {
digitalWrite(led1, HIGH);   
delay(1000);   
digitalWrite(led1, LOW);
delay(1000);   
digitalWrite(led2, HIGH);   
delay(1000);   
digitalWrite(led2, LOW);
delay(1000);
digitalWrite(led3, HIGH);   
delay(1000);   
digitalWrite(led3, LOW);
delay(1000);
digitalWrite(led4, HIGH);   
delay(1000);   
digitalWrite(led4, LOW);
delay(1000);   
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int...
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int main() {    …. } Rewrite the program include the following statements. Include the header file fstream, string, and iomanip in this program. Declare inFile to be an ifstream variable and outFile to be an ofstream variable. The program will read data from the file inData.txt and write output to the file outData.txt. Include statements to open both of these files, associate inFile with...
(C Programming Language) (MULTIPLE FORMS – HAPPY BIRTHDAY MESSAGE) Write a Visual Basic program to request...
(C Programming Language) (MULTIPLE FORMS – HAPPY BIRTHDAY MESSAGE) Write a Visual Basic program to request a date in the form of mm/dd/yyyy. If your date of birth is entered, display on a second Form the message                                                 BEST DATE IN HISTORY !                                                 HAPPY BIRTHDAY TO ME !! For any other date, display on a third Form the message                                                 Just Another Day.                                                 No Big Deal. Demonstrate your working program for the Instructor. Include a commented listing with...
In C++ Please, Write a program that (1) prompts for two integers, (2) prints out their...
In C++ Please, Write a program that (1) prompts for two integers, (2) prints out their sum, (3) prints out the first divided by the second, and (4) prints out the natural log of the first number raised to the power of the second number. #include <iostream> #include <iomanip> using namespace std; int main() { <your answer goes here> return 0; }
Write a program in the C ++ language that executes the following application 1-   Type function...
Write a program in the C ++ language that executes the following application 1-   Type function to find grade (a, b, c, d, e, fnil) 2-. Write a program that requires the user to enter student marks 3- Use the function to show the student's mark with grade
Write a program in the C ++ language that executes the following application 1- Define an...
Write a program in the C ++ language that executes the following application 1- Define an array consisting of 10 values 2- The user is allowed to enter 10 values 3- Prints the lowest value in the array
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...
Write the algorithm for this program using the C++ language (not python or java). The explanation...
Write the algorithm for this program using the C++ language (not python or java). The explanation needs to be at least 250 words. Explain everything throughly step by step. While there is a built-in pop_back function in the vector class, there is no built-in pop_front function. Suppose a program needs a pop_front function that will remove the first element from the vector. For example, if the original vector is [1, 2, 3, 4, 5], then after passing in this vector...
Perl language and by using VS Code: Write a program that reads a number, adds up...
Perl language and by using VS Code: Write a program that reads a number, adds up the cube of all the digits, and displays the result. Run your code with the following test number: 1242 It should give 81. Please include screenshots of your outputs.
In C++ Please, In the main(), below, write a program that uses a switch-statement to choose...
In C++ Please, In the main(), below, write a program that uses a switch-statement to choose between three numbers. The number, choice, should be prompted for and each choice should print out a unique statement. Also, the prompt should continue indefinitely (i.e. keep prompting until the user force-quits the program), and there should be a general catch-all if the user enters other than the three possible choices. #include <iostream> #include <iomanip> using namespace std; int main() { <your answer goes...
Assembly Language Programming create an .asm [assembly language program file, using Microsoft Visual Studio or equivalent...
Assembly Language Programming create an .asm [assembly language program file, using Microsoft Visual Studio or equivalent Windows32 integrated development environment (IDE)] program into one that inputs two positive integers, and outputs their greatest common divisor, by implementing the following pseudo-code: input num1 and num2 (assume num1 > 0 and num2 > 0) gcd := num1 remainder := num2 repeat numerator := gcd gcd := remainder remainder := numerator % gcd until (remainder == 0) output gcd The following 3 windows...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT