#### kooldude

Joined Feb 15, 2018
18
Hi is anyone is having answer for these questions.

#### Attachments

• 65.8 KB Views: 34

#### spinnaker

Joined Oct 29, 2009
7,835
You are the one that should have the answers since this is homework.

Show what you have done and folks will try to help.

#### kooldude

Joined Feb 15, 2018
18
if i would have done it then why i would have asked you

#### spinnaker

Joined Oct 29, 2009
7,835
if i would have done it then why i would have asked you

Do you always expect others to do your work for you? That is LAZY. If others do it for you then you learn nothing. Bet your instructor would be very interested in your attitude about learning.

#### dl324

Joined Mar 30, 2015
10,528
if i would have done it then why i would have asked you
Because having someone do your homework for you would be cheating.

#### ScottWang

Joined Aug 23, 2012
6,883
if i would have done it then why i would have asked you
The rules in this forum is that the members can't provide the direct answer to the poster as you, and only could help you to get the answer step by step, otherwise the member who provide the direct answer will be prohibit to come to this Homework Help forum, setup the rules is for the students to learn how to solve the problems.

Please be polite to the helpers and don't ask them to break the rules.

#### kooldude

Joined Feb 15, 2018
18
ok sorry guyz if might my words got misunderstood i have done some work on this just i want to know is it correct or not.I will share with you asap.

#### kooldude

Joined Feb 15, 2018
18
#include<stdio.h>

void setup() {

//nested loop to initialize all the pins

int n;

for(int i = 0; i < 1; i++){

for(int j = n; j >0; j--){

pinMode(pinMatrix[j], OUTPUT);

}

}

}

void loop() {

//nested loop which will turn each LED on and off in sequence

for(int i = 0; i <1; i++){

for(int j = n; j >0; j--){

digitalWrite(pinMatrix[j], HIGH);

}

}

this my solution please let me know if anything needs to be changed

#### dl324

Joined Mar 30, 2015
10,528
this my solution please let me know if anything needs to be changed
Code:
#include<stdio.h>
void setup() {
//nested loop to initialize all the pins
int n;
for (int i = 0; i < 1; i++) {
for (int j = n; j > 0; j--) {
pinMode(pinMatrix[j], OUTPUT);
}
}
}
void loop() {
//nested loop which will turn each LED on and off in sequence
for (int i = 0; i < 1; i++) {
for (int j = n; j > 0; j--) {
digitalWrite(pinMatrix[j], HIGH);
}
}
}
Doesn't look like it oscillates to me meaning of oscillate is unclear.

#### kooldude

Joined Feb 15, 2018
18
where pin matrix is written after that i is missing..

#### dl324

Joined Mar 30, 2015
10,528
where pin matrix is written after that i is missing..
You're missing a lot. The program as written won't compile and it wouldn't do anything without a main(). The loop function doesn't loop. The matrix size is undefined.

It's unclear from the problem description whether the pattern repeats when you get to the end or if it reverses when it gets to the end of the matrix.