What's new

C & C++ Request to delete

Vermouth the Gin

✌𝓝𝓮𝓿𝓮𝓻 𝓑𝓮𝓽𝓽𝓮𝓻 ✌
Established
Joined
May 15, 2019
Posts
1,415
Solutions
1
Reaction
323
Points
768
Request to delete

Misleading yung mga na generate ni bot, kung di pa to ma delete sa mga mag copy ng code nato try nyu muna po i simulate gamit ang tinkercad bago i upload sa Arduino uno.
 
Last edited:
Sure! Here's a basic circuit diagram for your Arduino program:

Arduino Circuit Diagram


In the circuit diagram, you can see that each LED is connected to a digital pin on the Arduino board. The even-numbered LEDs are connected to pins D0, D2, D4, D6, D8, D10, D12, and D13, while the odd-numbered LEDs are connected to pins D1, D3, D5, D7, D9, and D11. The button for blinking the odd LEDs is connected to pin A0, and the button for blinking the even LEDs is connected to pin A1.

To set up this circuit, you will need:

  • An Arduino board
  • 14 LEDs
  • 14 220-ohm resistors
  • Two buttons
  • Jumper wires
  • Breadboard

To connect the circuit, follow these steps:

1. Place the Arduino board on the breadboard so that it spans the middle channel.
2. Connect the positive (long) leg of each LED to a digital pin on the Arduino board, using a 220-ohm resistor for each LED.
3. Connect the negative (short) leg of each LED to the ground rail on the breadboard.
4. Connect one button to pin A0 on the Arduino board and to the ground rail on the breadboard.
5. Connect the other button to pin A1 on the Arduino board and to the ground rail on the breadboard.
6. Connect a jumper wire from the 5V pin on the Arduino board to the positive rail on the breadboard.
7. Connect a jumper wire from the ground pin on the Arduino board to the negative rail on the breadboard.

I hope this helps! Let me know if you have any questions or if there's anything else I can do for you.
Create an Arduino program that would create the following light patterns (in sequence) on the LEDs connected to DO-D13:

a. LED bouncing at the center and at the ends (5x)
 
Sure! Here's the Arduino code that would create a bouncing LED pattern at the center and at the ends:

Code:
const int LED_COUNT = 14;
const int LED_PINS[LED_COUNT] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
const int DELAY_TIME = 100;

void setup() {
  for (int i = 0; i < LED_COUNT; i++) {
    pinMode(LED_PINS[i], OUTPUT);
  }
}

void loop() {
  // Bouncing at the center
  for (int i = 0; i < 5; i++) {
    for (int j = 3; j <= 10; j++) {
      digitalWrite(LED_PINS[j], HIGH);
    }
    delay(DELAY_TIME);
    for (int j = 3; j <= 10; j++) {
      digitalWrite(LED_PINS[j], LOW);
    }
    delay(DELAY_TIME);
  }
 
  // Bouncing at the ends
  for (int i = 0; i < 5; i++) {
    digitalWrite(LED_PINS[0], HIGH);
    digitalWrite(LED_PINS[13], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[0], LOW);
    digitalWrite(LED_PINS[13], LOW);
   
    digitalWrite(LED_PINS[1], HIGH);
    digitalWrite(LED_PINS[12], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[1], LOW);
    digitalWrite(LED_PINS[12], LOW);
   
    digitalWrite(LED_PINS[2], HIGH);
    digitalWrite(LED_PINS[11], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[2], LOW);
    digitalWrite(LED_PINS[11], LOW);
   
    digitalWrite(LED_PINS[3], HIGH);
    digitalWrite(LED_PINS[10], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[3], LOW);
    digitalWrite(LED_PINS[10], LOW);
   
    digitalWrite(LED_PINS[4], HIGH);
    digitalWrite(LED_PINS[9], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[4], LOW);
    digitalWrite(LED_PINS[9], LOW);
   
    digitalWrite(LED_PINS[5], HIGH);
    digitalWrite(LED_PINS[8], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[5], LOW);
    digitalWrite(LED_PINS[8], LOW);
   
    digitalWrite(LED_PINS[6], HIGH);
    digitalWrite(LED_PINS[7], HIGH);
    delay(DELAY_TIME);
    digitalWrite(LED_PINS[6], LOW);
    digitalWrite(LED_PINS[7], LOW);
  }
}

Let me explain the code to you:

  • First, we define some constants to make our code more readable. LED_COUNT specifies how many LEDs we have, LED_PINS is an array that contains the pin numbers of the LEDs, and DELAY_TIME specifies the delay time between each LED bounce.
  • In the setup function, we set all the LED pins to output mode.
  • In the loop function, we first create a bouncing LED pattern at the center by turning on the LEDs connected to pins D3 to D10 for a short period of time, and then turning them off. We repeat this pattern five times.
  • Next, we create a bouncing LED pattern at the ends by turning on the LEDs at the edges of the strip (pins D0 and D13) for a short period of time, and then turning them off. We repeat this pattern five times.

To set up the circuit, you can follow the same steps as described in my previous answer.
Create an Arduino program that would create the following light patterns (in sequence) on the LEDs connected to DO-D13:

a. LED bouncing at the center when they meet and boundcing back at the ends (5x)
 
Pahelp code phc bot

Create an Arduino program that would create the following light patterns (in sequence) on the LEDs connected to DO-D13:

a. LED bouncing at the center when they meet and boundcing back at the ends
 
Sure, I can help you with that! Here's an Arduino program that will create a bouncing effect for LEDs connected to pins DO-D13:

Code:
int delayTime = 100; // you can adjust this to speed up or slow down the animation
int ledCount = 13;
int currentLed = 0;
int direction = 1;

void setup() {
  for (int i = 0; i < ledCount; i++) {
    pinMode(i, OUTPUT);
  }
}

void loop() {
  // turn off all LEDs
  for (int i = 0; i < ledCount; i++) {
    digitalWrite(i, LOW);
  }

  // turn on the current LED
  digitalWrite(currentLed, HIGH);

  // update the current LED index based on direction
  currentLed += direction;

  // reverse direction if we've reached the end
  if (currentLed == ledCount - 1 || currentLed == 0) {
    direction *= -1;
  }

  // delay before moving to the next LED
  delay(delayTime);
}

This code uses a delayTime variable to set the speed of the animation. You can adjust this value to make the bouncing effect faster or slower.

The ledCount variable is used to specify the number of LEDs connected to pins DO-D13.

The currentLed variable keeps track of the current LED that is turned on.

The direction variable is used to determine whether we are moving forward or backward through the LED sequence.

In the setup() function, we set each LED pin to OUTPUT mode.

In the loop() function, we first turn off all LEDs by setting them to LOW. Then, we turn on the LED at the current index by setting it to HIGH. We then update the currentLed variable by adding or subtracting 1 based on the direction. If we have reached the end of the LED sequence, we reverse the direction by multiplying it by -1. Finally, we delay for delayTime milliseconds before moving to the next LED in the sequence.
Arduino program code that would create the following light patterns (in sequence) on the LEDs connected to DO-D13:

a LED bouncing at the center and bounce back in reverse direction
 
Pa help phc bot

Create an Arduino program that would create the following light patterns (in sequence) on the LEDs connected to DO-D13:
a. LED bouncing at the center and at the ends (5x)
b. 1 LED at a time running to both ends (5x)
c. Alternately blink the Odd and Even LEDs (5x)
d. Bouncing ball effect (3x). From DO to D13
 
Sure! Here's a sample code that will create the light patterns you specified:

Code:
int delayTime = 100; // adjust this value to change the speed of the light patterns

void setup() {
  // initialize digital pins as outputs
  for(int i=2; i<=13; i++) {
    pinMode(i, OUTPUT);
  }
}

void loop() {
  // LED bouncing at the center and at the ends (5x)
  for(int i=2; i<=4; i++) {
    digitalWrite(i, HIGH);
    digitalWrite(13-i, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(13-i, LOW);
  }
  
  for(int i=5; i<=9; i++) {
    digitalWrite(i, HIGH);
    digitalWrite(14-i, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(14-i, LOW);
  }
  
  for(int i=10; i<=12; i++) {
    digitalWrite(i, HIGH);
    digitalWrite(25-i, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(25-i, LOW);
  }
  
  // 1 LED at a time running to both ends (5x)
  for(int i=2; i<=13; i++) {
    digitalWrite(i, HIGH);
    digitalWrite(14-i, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(14-i, LOW);
  }
  
  // Alternately blink the Odd and Even LEDs (5x)
  for(int i=2; i<=13; i+=2) {
    digitalWrite(i, HIGH);
  }
  
  delay(delayTime);
  
  for(int i=2; i<=13; i+=2) {
    digitalWrite(i, LOW);
  }
  
  for(int i=3; i<=13; i+=2) {
    digitalWrite(i, HIGH);
  }
  
  delay(delayTime);
  
  for(int i=3; i<=13; i+=2) {
    digitalWrite(i, LOW);
  }
  
  // Bouncing ball effect (3x). From DO to D13
  for(int i=2; i<=12; i++) {
    digitalWrite(i, HIGH);
    digitalWrite(i+1, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(i+1, LOW);
  }
  
  for(int i=12; i>=3; i--) {
    digitalWrite(i, HIGH);
    digitalWrite(i-1, HIGH);
    delay(delayTime);
    digitalWrite(i, LOW);
    digitalWrite(i-1, LOW);
  }
  
  delay(1000); // wait for 1 second before repeating the light patterns
}

This code uses a for loop to create each light pattern as specified in your requirements. The delayTime variable controls the speed of the light patterns. Feel free to adjust this value to suit your preferences.

I hope this helps! Let me know if you have any questions or if there's anything else I can assist you with.
 
phc bot help

arduino code for 14 led pin 0 to 13 moving both ends to the center and bounce and moving back to both ends and bounce
 
Here's an example code that can achieve what you're looking for:

Code:
int ledPin = 0; // starting pin number
int delayTime = 100; // delay time between LED on/off cycles

void setup() {
  // initialize all LED pins as outputs
  for (int i = 0; i < 14; i++) {
    pinMode(ledPin + i, OUTPUT);
  }
}

void loop() {
  // turn on LEDs from both ends to the center
  for (int i = 0; i <= 6; i++) {
    digitalWrite(ledPin + i, HIGH); // turn on first LED
    digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
    delay(delayTime); // wait
    digitalWrite(ledPin + i, LOW); // turn off first LED
    digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
  }
  
  // turn on LEDs from center to both ends
  for (int i = 6; i >= 0; i--) {
    digitalWrite(ledPin + i, HIGH); // turn on first LED
    digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
    delay(delayTime); // wait
    digitalWrite(ledPin + i, LOW); // turn off first LED
    digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
  }
  
  // turn on LEDs from both ends to the center and bounce back
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i <= 6; i++) {
      digitalWrite(ledPin + i, HIGH); // turn on first LED
      digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
      delay(delayTime); // wait
      digitalWrite(ledPin + i, LOW); // turn off first LED
      digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
    }
    for (int i = 5; i >= 0; i--) {
      digitalWrite(ledPin + i, HIGH); // turn on first LED
      digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
      delay(delayTime); // wait
      digitalWrite(ledPin + i, LOW); // turn off first LED
      digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
    }
  }
}

This code uses a for loop to iterate through the LEDs and turn them on and off in a specific pattern to achieve the desired effect. The delayTime variable can be adjusted to change the speed of the LED animation. Note that you may need to modify the code slightly depending on how your LEDs are wired and connected to your Arduino board.
 
Laking tulong nito bossing
hahaha nga lods eh wlng ibang nagbigay ng help basta programming dahil daw pinag aralan daw nila yun, may bayad talga most

Laking tulong nito bossing
bahala nlng kung hindi sakto sa output yung code atleast nlng ma studyhan parin lods

Here's an example code that can achieve what you're looking for:

Code:
int ledPin = 0; // starting pin number
int delayTime = 100; // delay time between LED on/off cycles

void setup() {
  // initialize all LED pins as outputs
  for (int i = 0; i < 14; i++) {
    pinMode(ledPin + i, OUTPUT);
  }
}

void loop() {
  // turn on LEDs from both ends to the center
  for (int i = 0; i <= 6; i++) {
    digitalWrite(ledPin + i, HIGH); // turn on first LED
    digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
    delay(delayTime); // wait
    digitalWrite(ledPin + i, LOW); // turn off first LED
    digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
  }
 
  // turn on LEDs from center to both ends
  for (int i = 6; i >= 0; i--) {
    digitalWrite(ledPin + i, HIGH); // turn on first LED
    digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
    delay(delayTime); // wait
    digitalWrite(ledPin + i, LOW); // turn off first LED
    digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
  }
 
  // turn on LEDs from both ends to the center and bounce back
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i <= 6; i++) {
      digitalWrite(ledPin + i, HIGH); // turn on first LED
      digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
      delay(delayTime); // wait
      digitalWrite(ledPin + i, LOW); // turn off first LED
      digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
    }
    for (int i = 5; i >= 0; i--) {
      digitalWrite(ledPin + i, HIGH); // turn on first LED
      digitalWrite(ledPin + 13 - i, HIGH); // turn on last LED
      delay(delayTime); // wait
      digitalWrite(ledPin + i, LOW); // turn off first LED
      digitalWrite(ledPin + 13 - i, LOW); // turn off last LED
    }
  }
}

This code uses a for loop to iterate through the LEDs and turn them on and off in a specific pattern to achieve the desired effect. The delayTime variable can be adjusted to change the speed of the LED animation. Note that you may need to modify the code slightly depending on how your LEDs are wired and connected to your Arduino board.
phc bot help

arduino code for 14 led pin 0 to 13 moving both ends moving opposite direction
 
Last edited:
phc bot help

arduino code for 14 led pin 0 to 13 moving both ends moving opposite direction
 
Sure, here's an example code for 14 LEDs connected to digital pins 0 to 13 on an Arduino Uno, moving in opposite directions:

Code:
C++
void setup() {
  for (int i = 0; i <= 13; i++) {
    pinMode(i, OUTPUT); // set the digital pins to OUTPUT mode
  }
}

void loop() {
  for (int i = 0; i <= 6; i++) {
    digitalWrite(i, HIGH); // turn on LEDs from pin 0 to 6
    digitalWrite(13 - i, HIGH); // turn on LEDs from pin 13 to 7
    delay(100); // wait for 100ms
    digitalWrite(i, LOW); // turn off LEDs from pin 0 to 6
    digitalWrite(13 - i, LOW); // turn off LEDs from pin 13 to 7
  }
  for (int i = 6; i >= 0; i--) {
    digitalWrite(i, HIGH); // turn on LEDs from pin 0 to 6
    digitalWrite(13 - i, HIGH); // turn on LEDs from pin 13 to 7
    delay(100); // wait for 100ms
    digitalWrite(i, LOW); // turn off LEDs from pin 0 to 6
    digitalWrite(13 - i, LOW); // turn off LEDs from pin 13 to 7
  }
}

This code uses two for loops to move the LEDs in opposite directions. The first for loop turns on the LEDs from pin 0 to 6 and from pin 13 to 7, and then turns them off in reverse order. The second for loop does the same thing, but in reverse order. The delay(100) statement is used to pause for 100 milliseconds between each movement. You can adjust the delay time to change the speed of the LED movement.
 
Sure, here's an example code for 14 LEDs connected to digital pins 0 to 13 on an Arduino Uno, moving in opposite directions:

Code:
C++
void setup() {
  for (int i = 0; i <= 13; i++) {
    pinMode(i, OUTPUT); // set the digital pins to OUTPUT mode
  }
}

void loop() {
  for (int i = 0; i <= 6; i++) {
    digitalWrite(i, HIGH); // turn on LEDs from pin 0 to 6
    digitalWrite(13 - i, HIGH); // turn on LEDs from pin 13 to 7
    delay(100); // wait for 100ms
    digitalWrite(i, LOW); // turn off LEDs from pin 0 to 6
    digitalWrite(13 - i, LOW); // turn off LEDs from pin 13 to 7
  }
  for (int i = 6; i >= 0; i--) {
    digitalWrite(i, HIGH); // turn on LEDs from pin 0 to 6
    digitalWrite(13 - i, HIGH); // turn on LEDs from pin 13 to 7
    delay(100); // wait for 100ms
    digitalWrite(i, LOW); // turn off LEDs from pin 0 to 6
    digitalWrite(13 - i, LOW); // turn off LEDs from pin 13 to 7
  }
}

This code uses two for loops to move the LEDs in opposite directions. The first for loop turns on the LEDs from pin 0 to 6 and from pin 13 to 7, and then turns them off in reverse order. The second for loop does the same thing, but in reverse order. The delay(100) statement is used to pause for 100 milliseconds between each movement. You can adjust the delay time to change the speed of the LED movement.
arduino code for led pin 0 to 13 moving from both end to other end
 
arduino code for led pin 0 to 13 moving from both end to other end
Sure, here is an example code for 14 LEDs connected to digital pins 0 to 13 on an Arduino Uno, moving from both ends to the other end:

Code:
C++
void setup() {
  for (int i = 0; i <= 13; i++) {
    pinMode(i, OUTPUT); // set the digital pins to OUTPUT mode
  }
}

void loop() {
  for (int i = 0; i <= 6; i++) {
    digitalWrite(i, HIGH); // turn on LED from pin 0
    digitalWrite(13 - i, HIGH); // turn on LED from pin 13
    delay(100); // wait for 100ms
    digitalWrite(i, LOW); // turn off LED from pin 0
    digitalWrite(13 - i, LOW); // turn off LED from pin 13
    digitalWrite(i + 1, HIGH); // turn on LED from pin 1
    digitalWrite(12 - i, HIGH); // turn on LED from pin 12
    delay(100); // wait for 100ms
    digitalWrite(i + 1, LOW); // turn off LED from pin 1
    digitalWrite(12 - i, LOW); // turn off LED from pin 12
  }
}

This code uses one for loop to move the LEDs from both ends to the other end. The loop turns on the LED from pin 0 and pin 13, and then turns them off in reverse order. Then, it turns on the LED from pin 1 and pin 12, and then turns them off in reverse order. The next iteration of the loop continues with turning on and off the LEDs from pin 2 and pin 11, and so on until all 14 LEDs have been turned on and off. The delay(100) statement is used to pause for 100 milliseconds between each movement. You can adjust the delay time to change the speed of the LED movement.
 
// initialize pins
int pins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};

void setup() {
for (int i = 0; i < 14; i++) {
pinMode(pins, OUTPUT);
}
}

void loop() {
// turn on LEDs from left to right
for (int i = 0; i < 7; i++) {
digitalWrite(pins, HIGH);
digitalWrite(pins[13-i], HIGH);
delay(100);
digitalWrite(pins, LOW);
digitalWrite(pins[13-i], LOW);
}

// turn on LEDs from right to left
for (int i = 6; i >= 0; i--) {
digitalWrite(pins, HIGH);
digitalWrite(pins[13-i], HIGH);
delay(100);
digitalWrite(pins, LOW);
digitalWrite(pins[13-i], LOW);
}
}
 
// initialize pins
int pins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};

void setup() {
for (int i = 0; i < 14; i++) {
pinMode(pins, OUTPUT);
}
}

void loop() {
// turn on LEDs from left to right
for (int i = 0; i < 7; i++) {
digitalWrite(pins, HIGH);
digitalWrite(pins[13-i], HIGH);
delay(100);
digitalWrite(pins, LOW);
digitalWrite(pins[13-i], LOW);
}

// turn on LEDs from right to left
for (int i = 6; i >= 0; i--) {
digitalWrite(pins, HIGH);
digitalWrite(pins[13-i], HIGH);
delay(100);
digitalWrite(pins, LOW);
digitalWrite(pins[13-i], LOW);
}
}
Maraming salamat lods!
 
Back
Top