Notifications
Clear all

Theatre chase in opposite directions.

155 Posts
6 Users
2 Likes
12 K Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @davy-ps

@will HaHa. I rewrote the sketch and it worked before I got your reply. I went over the original a few times and never noticed the second FastLed command was missing. Once I can accept but seven times!!!!!!!!!!

Original is now working too.

Call me cloth eyes.

Glad you got it working. I think that if you had gone through the original and switched it over to use the subroutine I supplied that it all would have worked then too. The sub had the second show embedded in it

Did davy8 do what you wanted for the blinking out multicoloured lights ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will Hi Will,

                   Thanks Mate. Davy8 is the effect I am after but I'd like to restrict it to two colours. As it stands it is a rainbow effect.

Thanks again to you and robotBuilder for your patience and help.

 

Davy.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @davy-ps

@will Hi Will,

                   Thanks Mate. Davy8 is the effect I am after but I'd like to restrict it to two colours. As it stands it is a rainbow effect.

Thanks again to you and robotBuilder for your patience and help.

All you need to do is populate the LEDColours array with the colours you want in the order that you want them and then remove the code section labeled " // Dummy setup for LED colours, change this as needed" so that your colours won't be overwritten.

The rest of the code should continue to work automatically.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @robotbuilder

@davy-ps 

Really made a mess with the code!!

Tried again. 

Here's a working version of robotBuilder's sketch in case anybody is curious.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@will 

Thank you!  Saved me lots of time trying to figure out where I went wrong.  So I forgot the fastLED setup stuff. I was using the Arduino IDE Monitor to test the logic which of course didn't need all that fastLED setup.

 


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will and robotBuilder. Spot on!!!!!!!!!!!! Exactly what I was after.

 

Cheers,

 

Davy.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@robotbuilder 

Yes, you also left the NUM_LEDS at 9 instead of 10 which left the leds array too short to hold the full length of the indices in the matrix.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @davy-ps

@will and @robotBuilder. Spot on!!!!!!!!!!!! Exactly what I was after.

Good, random chance has operated in your favour 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

Theatre Chase 2 colours.

 


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

  Guys . What is meant  by FastLED' does not name a type?

Cheers,

 

Davy.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@davy-ps 

It usually means that you forgot the #include for the library (or that you mis-spelled it 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will 

I added robotBuilder's sketch (RB2) to an already working sketch. The FastLed error message appears on bottom line.

Cheers,

Davy.

[code]
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>

#define LED_PIN 4
#define NUM_LEDS 11
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
#define NUM_COLOURS 6
#define NUM_REPEATS 1
// Define colours used
//CRGB colourOn = CRGB(255, 0, 0), colourBack;
//CRGB colourOff = CRGB(0, 0, 0);
CRGB colourList[6] = {CRGB(0, 0, 0), CRGB(255, 0, 0), CRGB(0, 0, 255), CRGB(255, 0, 0), CRGB(0, 255, 0), CRGB(0, 0, 255),};

// Define times for colour on and colour off in millis
int lengthOn = 10, lengthOff = 10;

int patterns[18][10] = {{1, 0, 0, 0, 0, 0, 0, 0, 0, 2},
{0, 1, 0, 0, 0, 0, 0, 0, 2, 0},
{0, 0, 1, 0, 0, 0, 0, 2, 0, 0},
{0, 0, 0, 1, 0, 0, 2, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 0, 0, 0, 0},
{0, 0, 0, 0, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
{0, 0, 2, 0, 0, 0, 0, 1, 0, 0},
{0, 2, 0, 0, 0, 0, 0, 0, 1, 0},
{2, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{0, 2, 0, 0, 0, 0, 0, 0, 1, 0},
{0, 0, 2, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 2, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 2, 0, 0},
{0, 1, 0, 0, 0, 0, 0, 0, 2, 0}
};

 

void setup() {
// Setup Serial Monitor
Serial.begin(9600);
Serial.println();

FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(250);
for (int i = 0; i < NUM_LEDS; ++i) {
leds[i] = colourList[0];

}
}
void loop() {
for (int i = 0; i < NUM_LEDS; ++i)
leds[i] = CHSV(hue + (i * 10), 255, 255);
}

//You can change the pattern speed here
EVERY_N_MILLISECONDS(300) {
hue++;

for (int j = 0; j < 18; j++)
{
// set color for every LED
for (int i = 0; i < 10; i++) {
leds[i] = colourList[ patterns[j][i] ];
}
FastLED.show();
delay(100);
}

}

 

FastLED.show();
leds[0] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);

leds[1] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);

leds[2] = CRGB(0, 25, 125); //Blue LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);

leds[3] = CRGB(0, 25, 125); //Blue LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);

leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[7] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[9] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[9] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[9] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[9] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[8] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);

leds[7] = CRGB(255, 255, 0); //Red LED
FastLED.show();
delay(00);
leds[7] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);

leds[6] = CRGB(0, 25, 125); //Blue LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);

leds[5] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[3] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[2] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[1] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[0] = CRGB(255, 0, 0); //Yellow LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[0] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);

leds[1] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);

leds[2] = CRGB(0, 25, 125); //Blue LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);

leds[3] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[7] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[8] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(100);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(100);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(00);
leds[7] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(100);

leds[6] = CRGB(0, 25, 125); //Blue LED
FastLED.show();
delay(100);
leds[6] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(100);

leds[5] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[5] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(100);
leds[4] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[3] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(100);
leds[3] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[2] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(100);
leds[2] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[1] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(100);
leds[1] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[0] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(100);
leds[0] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(100);

leds[0] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(1000);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(1000);

leds[1] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(1000);
leds[1] = CRGB(0, 0, 0); //Green LED
FastLED.show();
delay(1000);

leds[2] = CRGB(0, 0, 255); //Blue LED
FastLED.show();
delay(1000);
leds[2] = CRGB(0, 0, 0); //Blue LED
FastLED.show();
delay(1000);

leds[3] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[3] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[4] = CRGB(255, 255, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[4] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[5] = CRGB(25, 55, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[5] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[6] = CRGB(105, 25, 0); //Yellow LED
FastLED.show();
delay(1000);
leds[6] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[7] = CRGB(0, 95, 150); //Yellow LED
FastLED.show();
delay(1000);
leds[7] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[8] = CRGB(255, 0, 200); //Yellow LED
FastLED.show();
delay(1000);
leds[8] = CRGB(0, 0, 0); //Yellow LED
FastLED.show();
delay(1000);

leds[0] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[8] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[1] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[7] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[2] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[6] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[3] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[5] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[4] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[4] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[5] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[3] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[6] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[2] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[1] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[8] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[0] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[8] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[0] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[1] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[6] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[2] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[5] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[3] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[4] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[4] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[4] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[3] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[3] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[5] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[5] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[2] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[2] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[6] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[6] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[1] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[1] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[7] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[0] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(80);
leds[0] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[8] = CRGB(255, 0, 0); //Red LED
FastLED.show();
delay(80);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(80);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);

leds[8] = CRGB(0, 0, 255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(40);

leds[8] = CRGB(0, 0, 255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(40);

leds[7] = CRGB(0, 255, 0); //Red LED
FastLED.show();
delay(400);
leds[7] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);

leds[8] = CRGB(0, 0, 255); //Red LED
FastLED.show();
delay(400);
leds[8] = CRGB(0, 0, 0); //Red LED
FastLED.show();
delay(400);

 

}
[/code]


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @davy-ps

@will 

I added robotBuilder's sketch (RB2) to an already working sketch. The FastLed error message appears on bottom line.

It's probably because the compiler sensed the logical end of the sketch before the actual end of the code. I'm not even going to try to make sense of what you posted, it takes time to wade through unindented code to make sense of it and your return to the bloated format of the repeated sections code without using the subroutine supplied earlier will tax the patience of just about anyone.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will 

Fair comment Mate. How do I go about indenting the code? I have been using the 'Copy for Forum" function in Arduino, but that obviously doesn't transpose to this platform. As for the bloated format, it's what I can understand at this stage of my learning curve. 😉 I'll glean knowledge in bite size chunks and apply them as I progress. EG a random snip for (int j = 0; j < 18; j++) No idea what the hell this means, but Lights On /Lights off I can grasp.

 

Cheers  Mate.

 

Davy.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@davy-ps 

Are you using the Arduino IDE? If so I explained how one way to retain the indents a couple of posts ago.

My assumption here is that you have gotten the code from some (what?) source?

If your goal is to learn to program then we can help (as can online tutorials).

 

 

for (int j = 0; j < 18; j++){   // sets up a for loop, repeats code between { and } until j<18

  // repeat stuff here 18 times
  // each time variable j will be incremented by 1 (have 1 added to its value)

} // end of for loop when j is not less than 18


int j = 0  // assign a variable called j with the value of 0
j<18       // test if j is less than 18 
j++        // add one to j

 

 

 

 


   
ReplyQuote
Page 4 / 11