Things used in this project

Hardware components:
Cutout cortado grande
Punch Through LightBlue Bean
×1
Software apps and online services:
Punch Through Bean Loader
Ide web
Arduino IDE
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)
Pliers

Code

CodePlain text
#define BLEVEL 255
#define MINLEVEL 50

void setup() {
  Serial.begin(57600);
  pinMode(0, OUTPUT);
  pinMode(2, OUTPUT);
  digitalWrite(0, LOW);
}

void loop() {
  digitalWrite(0, HIGH);
  delay(10);
  int sensorValue = analogRead(A1);
  int r, g, b;
  if (sensorValue > MINLEVEL && sensorValue < BLEVEL + 1) {
    g = (sensorValue - MINLEVEL) / 2;
    b = 0;
  } else if (sensorValue > BLEVEL) {
      g = sensorValue - MINLEVEL;
      if (g > 255) {
        g = 255;
      }
      b = sensorValue - BLEVEL;
      if (b > 255) {
        b = 255;
      }
    } else {
      g = 0;
      b = 0;
    }
  Bean.setLed(0, g, b);
  tone(2, 300 + sensorValue * 10, 20);
}

Credits

11014907 917762441613247 2463536654633089299 o
Punch Through
16 projects • 37 followers
We’ve been building connected products since 2009. Our diverse team has expertise in every layer from hardware to software to web.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login