Arduino I

Spyridon Ampanavos

Arduino II

Spyridon Ampanavos

PIR Motion Sensor

Liam Brady

PIR sensors (or passive infrared sensors) are motion sensors that measure subtle changes in infrared light in the room and register that change as movement. The processing is done on the chip and it outputs a current based on whether or not it detects motion.

int pin = 2;

void setup(){
  pinMode(pin, INPUT);

  pinMode(13, OUTPUT);
}

void loop(){
  int pirVal = digitalRead(pin);

  if (pirVal == 0) {
    digitalWrite(13, HIGH);
  } else {
    digitalWrite(13, LOW);
  }

  delay(100);
}

NeoPixel LEDs

Spyridon Ampanavos
fastLED.ino
#include <FastLED.h>
#define NUM_LEDS 6
#define LED_PIN 5

CRGBArray<NUM_LEDS> leds;

void setup() {
    FastLED.addLeds<NEOPIXEL,LED_PIN>(leds, NUM_LEDS);
}

void loop() {
    for (int i = 0; i < NUM_LEDS; i+= 1) {
        leds[i] = CHSV(0, 255, 200);  // color format: (hue, saturation, value)
                                      // first number defines hue in a scale from 0 to 255
                                      // second number defines saturation in a scale from 0 to 255
                                      // third numbers defines brightness in a scale from 0 to 255
    }
    FastLED.show();

}

Infrared Distance Sensor

Liam Brady

Infrared distance sensors are sensors that measure how far away an object is by shooting infrared light at the object and measuring how much light is reflected back. They output an analog current which can be read by the Arduino.

void setup() {
  Serial.begin(9600);
}

void loop() {
  int val = analogRead(A0);

  Serial.println(val);

  delay(100);
}

NeoPixel LED Strip

Liam Brady

LED Strips are individually addressable ribbons of RGB (red green blue) lights, meaning that each light on the ribbon can be controlled by itself and give off any color on the visible color spectrum. Every light on the strip has its own chip onboard that processes commands given to it by the Arduino.

 

NeoPixel Library

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, 6, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
}

void loop() {
  for (int i = 0; i < strip.numPixels();  i++) {
    strip.setPixelColor(i, strip.Color(255, 0, 0));
  }

  strip.show();

  delay(100);
}