Zhenxuan’s homework 9

This is my final photo of the costume.
These are my making process.

This is my sketch.

And this is the image that inspiration me to make a wand. I learn from the part of this wand to make my own.

The material and tools:

  1. Wood club
  2. Kitchen paper
  3. Masking tape
  4. Soldering tools
  5. Spray-paint
  6. Wire
  7.  Ribbon
  8. Easter Grass

Arduino code

// Code by Erin St. Blaine for Adafruit Industries

// Color Touch Pendant Tutorial: https://learn.adafruit.com/color-touch-pendant-necklace/introduction

// Two neopixel rings connected on pin 1 will cycle through gradient colors when the pendant is touched.  For Gemma M0.

#include “Adafruit_FreeTouch.h”

#include <Adafruit_NeoPixel.h>

#define CAPTOUCH_PIN 0  //capacitive touch pin

#define NEOPIXEL_PIN 1  //neopixel ring pin

#define NUM_LEDS    16  //how many pixels total

//#define LED_TYPE    WS2812

//#define COLOR_ORDER GRB

Adafruit_NeoPixel strip(NUM_LEDS, NEOPIXEL_PIN, NEO_GRBW + NEO_KHZ800);

//CRGB leds[NUM_LEDS];   //LED array  

// Calibrating your capacitive touch sensitivity: Change this variable to something between your capacitive touch serial readouts for on and off

int touch = 400;    

long oldState = 0;

// set up capacitive touch button using the FreeTouch library

Adafruit_FreeTouch qt_1 = Adafruit_FreeTouch(CAPTOUCH_PIN, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE);

//TBlendType    currentBlending;

//CRGBPalette16 currentPalette;

void setup() {

  Serial.begin(115200);

  if (! qt_1.begin())  

   Serial.println(“Failed to begin qt on pin A1”);

   //FastLED.addLeds<WS2812, NEOPIXEL_PIN, COLOR_ORDER>(leds, NUM_LEDS);  // Set up neopixels with FastLED

   //FastLED.setBrightness(BRIGHTNESS); // set global brightness

   //FastLED.setMaxPowerInVoltsAndMilliamps(3,350);  //Constrain FastLED’s power usage

    strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)

  strip.show();            // Turn OFF all pixels ASAP

  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)

}

void loop() {

  Serial.print(qt_1.measure());

  Serial.write(‘ ‘);

  checkpress();   //check to see if the button’s been pressed

  //delay(20);

}

void checkpress() {

// Get current button state.

    long newState =  qt_1.measure();  

    Serial.println(qt_1.measure());

   if (newState > touch && oldState < touch) {

    // Short delay to debounce button.

    delay(500);

    // Check if button is still low after debounce.

    long newState =  qt_1.measure(); }

  if (newState > touch ) {  

  colorWipe(strip.Color(0,   0,   0,255)     , 50); // white

    }

    else{

        colorWipe(strip.Color(0,   0,   255, 0) , 2); // off

    }

  // Set the last button state to the old state.

  oldState = newState;

void colorWipe(uint32_t color, int wait) {

  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip…

    strip.setPixelColor(i, color);         //  Set pixel’s color (in RAM)

    strip.show();                          //  Update strip to match

    delay(wait);                           //  Pause for a moment

  }

}

Reflection

The whole parade I really get fun. And this is my first time to participate in Halloween parade, and I never dress up and make up for Halloween. It was really worth to make a lot of effort in preparing this event. Actually,I bought the custom before I figured out what exactly I want to do. Due to this custom, I decided to do a wand to match my custom. And it was successful in the end because at my first time I didn’t know if I can make it or not. I used a free touch to change the color of light inside of crystal ball. In the beginning, it was hard to find the use of the paper for making a wand look like hardness. Finally, I got masking tape to wind-up the wood. And I found the way to hide the circuit and the light which inside of crystal ball. The really tricky one was hiding switch because I pierced a hole to let me turn on or off. But even I can not find this hole quickly turn on or off the light. Also, the whole process is not easy; everyone gets fun in the parade.

WITCH COSTUME

I am going to dress up as a witch for Halloween. Based on the costume I bought, I decided to make a combination of a magic wand and a crystal ball.

The crystal ball will be combined with the touching sensor,Gemma Mo, to control the opening and closing of the led which will put into the crystal ball. When you touch the crystal ball, inside of Led will be turn on.

Zhenxuan’s week5 homework

#include <Adafruit_NeoPixel.h>

#define PIN 6

#define NUM_LEDS 4

#define BRIGHTNESS 5

// 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() {

  // Some example procedures showing how to display to the pixels:

  colorWipe(strip.Color(255, 0, 0), 50); // Red

  colorWipe(strip.Color(0, 255, 0), 50); // Green

  colorWipe(strip.Color(0, 0, 255), 50); // Blue

  colorWipe(strip.Color(0, 0, 0, 255), 50); // White

  pulseWhite(5); 

  // fullWhite();

  // delay(2000);

}

// Fill the dots one after the other with a color

void colorWipe(uint32_t c, uint8_t wait) {

  for(uint16_t i=0; i<strip.numPixels(); i++) {

    strip.setPixelColor(i, c);

    strip.show();

    delay(wait);

  }

}

void pulseWhite(uint8_t wait) {

  for(int j = 0; j < 256 ; j++){

      for(uint16_t i=0; i<strip.numPixels(); i++) {

          strip.setPixelColor(i, strip.Color(0,0,0, j ) );

        }

        delay(wait);

        strip.show();

      }

  for(int j = 255; j >= 0 ; j–){

      for(uint16_t i=0; i<strip.numPixels(); i++) {

          strip.setPixelColor(i, strip.Color(0,0,255, j ) );

        }

        delay(wait);

        strip.show();

      }

}

// Input a value 0 to 255 to get a color value.

// The colours are a transition r – g – b – back to r.

uint32_t Wheel(byte WheelPos) {

  WheelPos = 255 – WheelPos;

  if(WheelPos < 85) {

    return strip.Color(255 – WheelPos * 3, 0, WheelPos * 3,0);

  }

  if(WheelPos < 170) {

    WheelPos -= 85;

    return strip.Color(0, WheelPos * 3, 255 – WheelPos * 3,0);

  }

  WheelPos -= 170;

  return strip.Color(WheelPos * 3, 255 – WheelPos * 3, 0,0);

}

uint8_t red(uint32_t c) {

  return (c >> 8);

}

uint8_t green(uint32_t c) {

  return (c >> 16);

}

uint8_t blue(uint32_t c) {

  return (c);

}

BRAINBRAIN (Plush Night Light)

BRAINBRAIN IN THE BRIGHT LIGHT~
BRAINBRAIN IN THE DARK~
Circuit diagram

STORY

This toy is designed for white-collar workers who spend plenty of time in the office environment. Because of this environment, some people will interrupt your work when you are thinking. Usually, people don’t want to be distracted by other people when they are working on their project.

Therefore, there is BRAINBRAIN on your desk. You can just turn on the toy and the alien’s head will be bright. It means that you are thinking right now, please come later.

Zhenxuan’s Arduino Homework2

// constants won’t change. They’re used here to set pin numbers:
const int onbutton = 2; // the number of the pushbutton pin
const int offbutton = 3;
const int jeremy = 13; // the number of the LED pin

// variables will change:
int whatisit = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(jeremy, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(onbutton, INPUT);
pinMode(offbutton, INPUT);
}

void loop() {
// read the state of the pushbutton value:
whatisit = digitalRead(onbutton);
if (whatisit == 1) {
// turn LED on:
digitalWrite(jeremy, HIGH);
}
whatisit = digitalRead(offbutton);
if (whatisit == 1) {
digitalWrite(jeremy, LOW);
}

}