Punch Through
Published © MIT

Theremin

Curious about building a Theremin instrument? Checkout this tutorial!

IntermediateFull instructions provided1,386
Theremin

Things used in this project

Hardware components

LightBlue Bean
Punch Through LightBlue Bean
×1

Software apps and online services

Punch Through Bean Loader
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Pliers

Story

Read more

Code

Code

Plain 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

Punch Through

Punch Through

16 projects • 39 followers
We’ve been building connected products since 2009. Our diverse team has expertise in every layer from hardware to software to web.
Contact

Comments

Add projectSign up / Login