Offline/Standalone Project

Week 5 to Week 7

During these past few weeks, I have been working with the Arduino Editor in order to program code into the Arduino. One problem that I faced was using the Arduino Desktop Editor, but realized that it had problems attempting to read my USB ports. I then successfully used the Arduino Web Based editor.

I first tested to see if the Arudino was working using the Blink Test. From here, I then connected the wires and buttons to the breadboard, and proceeded to connect the wires to the Arduino. Then, I connected the LED lights to the bread board.

However, there were many errors that occured:

  1. Buttons were not working when clicked onto
  2. When buttons were pushed, LED light would not show up
  3. Connecting wires to the wrong end of the board disabled the button’s abilities to fee information to the Arduino.
  4. Only certain number of lights on the LED were lighting up
#include <Adafruit_NeoPixel.h>

#define PIN 2	 // input pin Neopixel is attached to

#define NUMPIXELS      30 // number of neopixels in Ring

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 100; // timing delay

int redColor = 0;
int greenColor = 0;
int blueColor = 0;

int button1 = 0;
int button2 = 0;
int button3 = 0;



void setup() {
  pixels.begin(); // Initializes the NeoPixel library.
//  Serial.begin(9600);
}

void loop() {
  
   noColor();
    
    button1 = digitalRead(6);
  	if (button1 == HIGH){
  	  setColor();
  	} 
  	
  	button2 = digitalRead(7);
  	if (button2 == HIGH){
  	  setColor2();
  	} 
  	
  	button3 = digitalRead(8);
  	if (button3 == HIGH){
  	  setColor3();
  	} 
  	
  	
  //setColor();

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

   
    pixels.setPixelColor(i, pixels.Color(redColor, greenColor, blueColor)); 

    pixels.show(); 

    //delay(delayval); 
    
    // Serial.println(i);
    
    if (i == NUMPIXELS){
    	i = 0; // start all over again!
        noColor();
	  }

  }
}

// setColor()
// picks random values to set for RGB

void setColor(){
  redColor = 0;
  greenColor = 255;
  blueColor = 255;
  Serial.print("red: ");
  Serial.println(redColor);
  Serial.print("green: ");
  Serial.println(greenColor);
  Serial.print("blue: ");
  Serial.println(blueColor);
  
};

void setColor2() {
  redColor = 300;
  greenColor = 10;
  blueColor = 0;
};

void setColor3() {
  redColor = 255;
  greenColor = 0;
  blueColor = 255;
};

void noColor() {
  redColor = 255;
  greenColor = 255;
  blueColor = 255;
};