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
(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...
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...
Write a program using K-Means and Expectation Maximization clustering for the given dataset. Use R language...
Write a program using K-Means and Expectation Maximization clustering for the given dataset. Use R language to write the code. Package Name: cluster.datasets install.packages("cluster.datasets") library(cluster.datasets) data(paste your data set name) your dataset name data(mammal.dentition) K-Means Clustering Find optimal number of clusters using Elbow Method and then Apply K-Means clustering. Finally do visualization for K-Means Clustering Expectation Maximization Clustering Q1: Apply Expectation Maximization Q2: Visualization for Expectation Maximization https://www.rdocumentation.org/packages/cluster.datasets/versions/1.0-1/topics/mammal.dentition I have done the K-means part do the second one
Write the following ANNA assembly language programs. 1.HighestnumberWrite an ANNA assembly program (high.ac) that will continuously...
Write the following ANNA assembly language programs. 1.HighestnumberWrite an ANNA assembly program (high.ac) that will continuously prompt the user for numbers. When the user enters a negative number, print the highest positive number entered by the user and exit the program. Print a zero if they did not enter any positive numbers. 2.DivisionWrite an ANNA assembly program (div.ac) that divides two positive numbers that come from user input and returns both the quotient and the remainder. For example, if the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT