From dbb758c7ff3bd7ebfca053618f992bcab7f775c1 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Mon, 29 Apr 2019 20:07:41 +1200 Subject: [PATCH] Fixed Filesystem? --- Theremin/Theremin.ino | 6 ++---- Theremin/Theremin/Theremin.ino | 45 ------------------------------------------ 2 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 Theremin/Theremin/Theremin.ino diff --git a/Theremin/Theremin.ino b/Theremin/Theremin.ino index 02a4ca5..f0b6f92 100644 --- a/Theremin/Theremin.ino +++ b/Theremin/Theremin.ino @@ -14,8 +14,6 @@ void setup() { pinMode(12, INPUT); //echo pin if (digitalRead(0) ==HIGH){ mode = 0; - } - else{ mode = 1; } } @@ -37,9 +35,9 @@ float getNote() echoTime = pulseIn(12, HIGH); calculatedDistance = echoTime / 8; calculatedDistance += 110; - if (calculatedDistance > 1720){ + if (calculatedDistance > 1760){ // - calculatedDistance = 880; + calculatedDistance = 1760; } Serial.print(calculatedDistance); //print units after the distance Serial.println(" hz"); //print units after the distance diff --git a/Theremin/Theremin/Theremin.ino b/Theremin/Theremin/Theremin.ino deleted file mode 100644 index f0b6f92..0000000 --- a/Theremin/Theremin/Theremin.ino +++ /dev/null @@ -1,45 +0,0 @@ -/* - *@author James McKenzie - *@lang C89 Based - *@contact lunarised@outlook.com - */ - int mode; -void setup() { - pinMode(0, INPUT_PULLUP); - pinMode (13, OUTPUT); - pinMode(8, OUTPUT); - Serial.begin (9600); //set up a serial connection with the computer - - pinMode(11, OUTPUT); //the trigger pin - pinMode(12, INPUT); //echo pin - if (digitalRead(0) ==HIGH){ - mode = 0; - mode = 1; - } -} - -void loop() { - if (mode == 0){ - digitalWrite(13, HIGH); - tone(8, getNote()); - } -} -float getNote() -{ - float echoTime; - float calculatedDistance; - digitalWrite(11, HIGH); - delayMicroseconds(20); - digitalWrite(11, LOW); - - echoTime = pulseIn(12, HIGH); - calculatedDistance = echoTime / 8; - calculatedDistance += 110; - if (calculatedDistance > 1760){ // - - calculatedDistance = 1760; - } - Serial.print(calculatedDistance); //print units after the distance - Serial.println(" hz"); //print units after the distance - return calculatedDistance; -}