diff options
author | dakkar <dakkar@thenautilus.net> | 2020-08-22 12:31:45 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2020-08-22 12:31:45 +0100 |
commit | 0f0f13bf57c38d0cde67a3cd083f26e546c1e50e (patch) | |
tree | 0e848c3d3722f05c78e4eb1ebb4371790f4c68f0 /esp32/lego-piano.ino | |
parent | move amp setup together (diff) | |
download | lego-piano-0f0f13bf57c38d0cde67a3cd083f26e546c1e50e.tar.gz lego-piano-0f0f13bf57c38d0cde67a3cd083f26e546c1e50e.tar.bz2 lego-piano-0f0f13bf57c38d0cde67a3cd083f26e546c1e50e.zip |
different wiring
* pins above 33 don't work as output, according to the esp32 source
code
* the TTGO-T7 / Mini32 doesn't like using some pins
* this still doesn't work
Diffstat (limited to 'esp32/lego-piano.ino')
-rw-r--r-- | esp32/lego-piano.ino | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/esp32/lego-piano.ino b/esp32/lego-piano.ino index 3cd5986..4a88556 100644 --- a/esp32/lego-piano.ino +++ b/esp32/lego-piano.ino @@ -22,7 +22,7 @@ int currentLed = 0; int lastSeen = 100; const int rows[] = { 5, 23, 19, 18, 26 }; -const int cols[] = { 34, 33, 35, 21, 22 }; +const int cols[] = { 7, 33, 8, 21, 22 }; const int adc[] = { 2, 4, 12, 27, 14 }; const int ampEnable = 32; @@ -37,8 +37,8 @@ void setup() { dac_output_enable(DAC_CHANNEL_1); for (int i=0;i<5;++i) { - pinMode(rows[i], OUTPUT); - pinMode(cols[i], OUTPUT); + pinMode(rows[i], OUTPUT|PULLUP); + pinMode(cols[i], OUTPUT|PULLDOWN); pinMode(adc[i], INPUT); } @@ -68,18 +68,18 @@ void mute() { } void tristate(int pin) { - pinMode(pin,OUTPUT); + pinMode(pin,OUTPUT|PULLDOWN); digitalWrite(pin,LOW); pinMode(pin,INPUT); } void power(int pin) { - pinMode(pin,OUTPUT); + pinMode(pin,OUTPUT|PULLUP); digitalWrite(pin,HIGH); } void ground(int pin) { - pinMode(pin,OUTPUT); + pinMode(pin,OUTPUT|PULLDOWN); digitalWrite(pin,LOW); } @@ -105,7 +105,7 @@ int sense(int led) { int value = analogRead(adc[row]); - //Serial.println(value); + Serial.println(value); return value < 500; } @@ -144,7 +144,7 @@ void loop() { /* Serial.println(currentLed); */ enableLed(currentLed); - delay(1); + delay(5); if (sense(currentLed)) { if (lastSeen != currentLed) { lastSeen = currentLed; @@ -158,5 +158,5 @@ void loop() { mute(); } - currentLed = (currentLed+1)%25; + currentLed = (currentLed+1)%10; }
\ No newline at end of file |