Question Solved1 Answer 10 Experiment 4: Combining All Three Experiments Now that you have been introduced to three different topics, it's time to put it all together. For your final project, you are to work with four different color LEDs, each one connected to its own Arduino pin: red, yellow, blue, green. By entering commands in the serial monitor, you can either turn an LED 10 Experiment 4: Combining All Three Experiments Now that you have been introduced to three different topics, it's time to put it all together. For your final project, you are to work with four different color LEDs, each one connected to its own Arduino pin: red, yellow, blue, green. By entering commands in the serial monitor, you can either turn an LED HIGH, LOW, ON with a specific intensity, or blink X times, with \( \mathrm{Y} \mathrm{ms} \) on and \( \mathrm{Z} \mathrm{ms} \) off each blink cycle. Note you should make a library to make the main code cleaner. As a guidance, your LED library should be called LED. The LED library should have the following functions: - Constructor - Turn the LED on - Turn the LED off - Set LED intensity (requires an integer input) - Blink the LED for \( \mathrm{X} \) times, with \( \mathrm{Y} \mathrm{ms} \) on, and \( \mathrm{Z} \) ms for each blink cycle. The user enter the LED, command, and input values on one line, and automatically figure out the proper information. For example, if the user wanted to set the red LED on, they enter "red,on" at the serial monitor. In the same token, if the user wanted to blink the yellow LED 5 times for 1000 \( \mathrm{ms} \) on, and \( 500 \mathrm{~ms} \) off, they would enter "yellow,blink, \( 5,1000,500 \) " in the serial monitor. As a guidance the student may want to research the following commands: - String methods \( - \). equals () - .toLowerCase() - .toCharArray()

ECPIMI The Asker · Computer Science

​​​​​​​By using Arduino

Transcribed Image Text: 10 Experiment 4: Combining All Three Experiments Now that you have been introduced to three different topics, it's time to put it all together. For your final project, you are to work with four different color LEDs, each one connected to its own Arduino pin: red, yellow, blue, green. By entering commands in the serial monitor, you can either turn an LED HIGH, LOW, ON with a specific intensity, or blink X times, with \( \mathrm{Y} \mathrm{ms} \) on and \( \mathrm{Z} \mathrm{ms} \) off each blink cycle. Note you should make a library to make the main code cleaner. As a guidance, your LED library should be called LED. The LED library should have the following functions: - Constructor - Turn the LED on - Turn the LED off - Set LED intensity (requires an integer input) - Blink the LED for \( \mathrm{X} \) times, with \( \mathrm{Y} \mathrm{ms} \) on, and \( \mathrm{Z} \) ms for each blink cycle. The user enter the LED, command, and input values on one line, and automatically figure out the proper information. For example, if the user wanted to set the red LED on, they enter "red,on" at the serial monitor. In the same token, if the user wanted to blink the yellow LED 5 times for 1000 \( \mathrm{ms} \) on, and \( 500 \mathrm{~ms} \) off, they would enter "yellow,blink, \( 5,1000,500 \) " in the serial monitor. As a guidance the student may want to research the following commands: - String methods \( - \). equals () - .toLowerCase() - .toCharArray()
More
Transcribed Image Text: 10 Experiment 4: Combining All Three Experiments Now that you have been introduced to three different topics, it's time to put it all together. For your final project, you are to work with four different color LEDs, each one connected to its own Arduino pin: red, yellow, blue, green. By entering commands in the serial monitor, you can either turn an LED HIGH, LOW, ON with a specific intensity, or blink X times, with \( \mathrm{Y} \mathrm{ms} \) on and \( \mathrm{Z} \mathrm{ms} \) off each blink cycle. Note you should make a library to make the main code cleaner. As a guidance, your LED library should be called LED. The LED library should have the following functions: - Constructor - Turn the LED on - Turn the LED off - Set LED intensity (requires an integer input) - Blink the LED for \( \mathrm{X} \) times, with \( \mathrm{Y} \mathrm{ms} \) on, and \( \mathrm{Z} \) ms for each blink cycle. The user enter the LED, command, and input values on one line, and automatically figure out the proper information. For example, if the user wanted to set the red LED on, they enter "red,on" at the serial monitor. In the same token, if the user wanted to blink the yellow LED 5 times for 1000 \( \mathrm{ms} \) on, and \( 500 \mathrm{~ms} \) off, they would enter "yellow,blink, \( 5,1000,500 \) " in the serial monitor. As a guidance the student may want to research the following commands: - String methods \( - \). equals () - .toLowerCase() - .toCharArray()
See Answer
Add Answer +20 Points
Community Answer
898MHA The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

Arduino IDE code for blinking three LEDs and displaying their outputs: const int LED = 13;  //Assign pin 13 a name e.g. LED void setup()  {  Serial.begin (9600);   //initialise the serial monitor data rate at 9600bps  pinMode(LED, OUTPUT);  //configure the digital pin as an output } void loop()  {       digitalWrite(LED, HIGH);  //control the digital pin to turn the LED on   Serial.println("LED is on"); //receive a signal in the serial monitor to show LED is on   delay(1000);   //a delay to blink the LED in 1 second intervals   digitalWrite(LED, LOW);  //control the digital pin to turn the LED off   Serial.println("LED is off"); //receive a signal in the serial monitor to show LED is off   delay(1000); //a delay to blink the LED in 1 second intervals } Basic arduino code for blinking 3 LEDs(RGB): int R = 12;int G = 11;int B = 10; // Assign integer R,G,B pins to 12,11,10 respectively void setup(){  pinMode  // configure the digital pins R as Output (R,OUTPUT);  pinMode // configure the digital pin R as output (G,OUTPUT);  pinMode // configure the digital pin G as output (B,OUTPUT); } void loop(){  digitalWrite (R,HIGH);  delay (1000);  digitalWrite (R,LOW);  delay (1000);  digitalWrite (G,HIGH);  delay (1000);  digitalWrite (G,LOW);  delay (1000);  digitalWrite (B,HIGH);  delay (1000);  digitalWrite (B,LOW);  delay (1000); } Description: 1.digitalWrite (R,HIGH);  delay (1000); so after  one second we must tell arduino to set pin no” 12” ie” R” to position” low”  which is “OFF”.  2. digitalWrite (R,LOW); This programme will programme three LEDs, R, G, and B, to turn "ON" and "OFF" for an extended period of time. You can also programme more than three LEDs to turn on and off as desired. This tutorial is designed to help newcomers understand the programme and play with Arduino. 3. delay (1000); This is a complete loop for pin 12, which was designated for th ... See the full answer