#include <Adafruit_NeoPixel.h>
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(40, PIN, NEO_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit... if you must, connect GND first.
void setup() {
strip.begin();
strip.show(); // initialize all pixels to "off"
}
void loop() {
brighten();
darken();
}
// 0 to 255
void brighten() {
uint16_t i, j;
for (j = 0; j < 255; j++) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, 0, 255);
}
strip.show();
delay(10);
}
//delay(100);
}
// 255 to 0
void darken() {
Serial.begin(9600);
uint16_t i, j;
for (j = 255; j > 0; j--) {
for (i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, 0, j);
}
strip.show();
delay(10);
Serial.println(j);
}
delay(100);
}
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum
Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
Please edit your post, select all code and click the <CODE/> button; next save your post.
This will apply code tags so the code is easier to read, easier to copy and the forum software will display it corfrectly.
How does this relate to Arduino command line tools? I see that the topic has already been moved.
Are you having problems? If so, what kind of problems?
- Compile problems? Please post the error output.
- Upload problems? Please post the error output.
- Or does the code not behave as expected? Describe what it does and how this differs from your expectation.
No i just answered that question !
Thanks for showing that error, I'll be sure about that and correct that error
You did not answer a question; you started a new topic.
So I'm confused.
Someone is asking that question so, i just answered in that form that's why you confused :-):- :-)
Why didn't you answer in the original topic ?
If you can provide a link to the original topic then I will merge them
Yeah sure , I'm making it correct !!
Topic closed to prevent anyone else wasting time on it.
@saurav_satpathy-1403 please see the PM I have sent you and please follow the forum guide before posting anything else.
1 Like