tech guy
Published

Tone Keyboard

This project is a simple tone keyboard.

IntermediateShowcase (no instructions)15 minutes961
Tone Keyboard

Things used in this project

Story

Read more

Schematics

keynote

Code

tone_keyboard.ino

Arduino
const int sw1pin = 6;
const int sw2pin = 7;
const int soundPin = 8;

void setup() {
  pinMode(sw1pin, INPUT_PULLUP);
  pinMode(sw2pin, INPUT_PULLUP);
  pinMode(soundPin, OUTPUT);
}

void loop() {
  if (! digitalRead(sw1pin)) {
    tone(soundPin, 200);
  }
  else if (! digitalRead(sw2pin)) {
    tone(soundPin, 400);
  }
  
  else {
    noTone(soundPin);
  }
}

Credits

tech guy

tech guy

7 projects • 6 followers

Comments