Playtesting

Alan and I made a small cardboard prototype of our stump. We painted “tree rings” with conductive paint and hooked it up to a neopixel strip. Each ring corresponds to a different light on the strip. We have also sliced our tree stump into smaller pieces and plan to hollow it out.


//Alan Tett and Abby Rinerson
//ATLS 3300 Object, Spring 2019
//Final project prototype demo
#include <CapacitiveSensor.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 11
Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, PIN, NEO_GRB + NEO_KHZ800);
//https://playground.arduino.cc/Main/CapacitiveSensor/
CapacitiveSensor ring1 = CapacitiveSensor(4, 2);
CapacitiveSensor ring2 = CapacitiveSensor(4, 3);
CapacitiveSensor ring3 = CapacitiveSensor(4, 5);
CapacitiveSensor ring4 = CapacitiveSensor(4, 6);
CapacitiveSensor ring5 = CapacitiveSensor(4, 8);
void setup() {
Serial.begin(9600);
ring1.set_CS_AutocaL_Millis(0xFFFFFFFF);
ring2.set_CS_AutocaL_Millis(0xFFFFFFFF);
ring3.set_CS_AutocaL_Millis(0xFFFFFFFF);
ring4.set_CS_AutocaL_Millis(0xFFFFFFFF);
ring5.set_CS_AutocaL_Millis(0xFFFFFFFF);
strip.begin();
strip.show();
}
void loop() {
int threshold = 200;
long start = millis();
long total1 = ring1.capacitiveSensor(30);
long total2 = ring2.capacitiveSensor(80);
long total3 = ring3.capacitiveSensor(30);
long total4 = ring4.capacitiveSensor(80);
long total5 = ring5.capacitiveSensor(80);
Serial.print(millis() – start);
Serial.print("\t");
Serial.print(total1);
Serial.print("\t");
Serial.print(total2);
Serial.print("\t");
Serial.print(total3);
Serial.print("\t");
Serial.print(total4);
Serial.print("\t");
Serial.println(total5);
delay(50);
if (total1 > threshold) {
strip.setPixelColor(1, total1, 0, total1);
}
else {
strip.setPixelColor(1, 0, 0, 0);
}
if (total2 > threshold) {
strip.setPixelColor(2, total2, 0, total2);
}
else {
strip.setPixelColor(2, 0, 0, 0);
}
if (total3 > threshold) {
strip.setPixelColor(3, total3, 0, total3);
}
else {
strip.setPixelColor(3, 0, 0, 0);
}
if (total4 > threshold) {
strip.setPixelColor(4, total4, 0, total4);
}
else{
strip.setPixelColor(4, 0, 0, 0);
}
if (total5 > threshold) {
strip.setPixelColor(0, total5, 0, total5);
}
else{
strip.setPixelColor(0, 0, 0, 0);
}
strip.show();
delay(10);
}

view raw

playtesting.ino

hosted with ❤ by GitHub

Leave a comment