Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Michelangelo Guarise
Published

UDOO Theremin

Revive an iconic musical instrument with UDOO!

Full instructions provided1,905
UDOO Theremin

Things used in this project

Hardware components

UDOO DUAL
UDOO DUAL
×1

Story

Read more

Code

code.txt

C/C++
int IRpin = A0;
int distance = 0;
int msg = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly: 
  distance = analogRead(IRpin);
  
  if (distance < 100) {
    distance = 100;  
  } else if (distance > 900){
    distance = 900;
  }

  msg = map(distance, 100, 900, 0, 255);
  Serial.write(msg);
}

Credits

Michelangelo Guarise
7 projects • 57 followers
Founder @ volumio.org , passionate maker, unpredictable developer, misunderstood creative. I do stuff, I build things.
Contact

Comments

Please log in or sign up to comment.