Karan’s Week 5 Assignment

Motor Circuit

Custom Neopixel

Adobe Color Picker palette



My code

If the embed is not working, please refer the code below.

<pre>

include

define PIN 6

define NUM_LEDS 5

define BRIGHTNESS 50

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream, correct if colors are swapped upon testing
// NEO_RGBW Pixels are wired for RGBW bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip), correct for neopixel stick
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);

void setup() {

strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {

customFunction(strip.Color(191,255,71), 100);
customFunction(strip.Color(232,168,44), 100);
customFunction(strip.Color(255,71,61), 100);
customFunction(strip.Color(127,44,232), 100);
customFunction(strip.Color(66,206,255), 100);

}

void customFunction(uint32_t c, uint8_t wait){
for(uint16_t i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

</pre>

https://www.tinkercad.com/things/2VCL79GbYxK

Discover more from Making Studio

Subscribe now to keep reading and get access to the full archive.

Continue reading