diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-04-01 11:21:01 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-04-01 11:21:01 +0200 |
commit | 178433e53d2e5fe9ccc5bc5862494d811b938e51 (patch) | |
tree | 8b15bb2a99c4d9954e7902816dbf43e647ac553f | |
parent | 659b44912e9a307d51ecb5a5ea0c76e3a3fff096 (diff) |
more hardwre debugging
-rw-r--r-- | hardware/hardware.kicad_prl | 2 | ||||
-rw-r--r-- | logboek.md | 3 | ||||
-rw-r--r-- | software/software.ino | 69 |
3 files changed, 61 insertions, 13 deletions
diff --git a/hardware/hardware.kicad_prl b/hardware/hardware.kicad_prl index 70aad3e..7db68af 100644 --- a/hardware/hardware.kicad_prl +++ b/hardware/hardware.kicad_prl @@ -1,6 +1,6 @@ { "board": { - "active_layer": 47, + "active_layer": 0, "active_layer_preset": "", "auto_track_width": false, "hidden_nets": [], @@ -40,4 +40,7 @@ |Sat Mar 12 03:22:40 PM CET 2022|03:12:21|elektrisch schema| |Sat Mar 12 06:37:00 PM CET 2022|00:30:00|qr code toevoegen aan pcb| |Thu Mar 24 01:04:48 PM CET 2022|03:33:55|solderen / in mekaar zetten| +|Fri Mar 25 02:19:34 PM CET 2022|04:12:41|solderen / in mekaar zetten| +|Tue Mar 29 03:26:20 PM CET 2022|01:02:15|debuggen| +|Fri Apr 1 11:17:41 AM CEST 2022|02:03:32|debuggen en arduino software schrijven| diff --git a/software/software.ino b/software/software.ino index 376a8d5..28edfaf 100644 --- a/software/software.ino +++ b/software/software.ino @@ -1,23 +1,68 @@ #include "lib/the_synth/synth.h" +#define PINOUT_AUDIO_OUT CHA +#define PINOUT_POT_ATK A0 +#define PINOUT_POT_REL A1 +#define PINOUT_POT_WAV A2 +#define PINOUT_KB_IN A3 + synth bernard; +const static unsigned int notes[] = { + 751, // f3 + 751, // f#3 + 744, // g3 + 743, // g#3 + 736, // a3 + 733, // a#3 + 730, // b3 + 725, // c4 + 720, // c#4 + 660, // d4 + 655, // d#4 + 650, // e4 + 642, // f4 + 635, // f#4 + 626, // g4 + 610, // g#4 + 602, // a4 + 595, // a#4 + 580, // b4 + 550, // c5 +}; + void setup() { - bernard.begin(); + pinMode(PINOUT_AUDIO_OUT, OUTPUT); + bernard.begin(PINOUT_AUDIO_OUT); + + pinMode(PINOUT_POT_ATK, INPUT); + pinMode(PINOUT_POT_WAV, INPUT); + pinMode(PINOUT_POT_REL, INPUT); + pinMode(PINOUT_KB_IN, INPUT); bernard.setupVoice(0,SINE,60,ENVELOPE0,90,64); - bernard.setupVoice(1,SINE,62,ENVELOPE1,90,64); - bernard.setupVoice(2,SINE,64,ENVELOPE2,90,64); - bernard.setupVoice(3,SINE,67,ENVELOPE0,90,64); + bernard.setupVoice(1,TRIANGLE,62,ENVELOPE1,90,64); + bernard.setupVoice(2,SAW,64,ENVELOPE2,90,64); + bernard.setupVoice(3,SQUARE,67,ENVELOPE0,90,64); + + Serial.begin(9600); } void loop() { - bernard.trigger(0); - delay(1000); - bernard.trigger(1); - delay(1000); - bernard.trigger(2); - delay(1000); - bernard.trigger(3); - delay(1000); + int samples = 100; + double average = 0.0; + for (int i = 0; i < samples; i++) { + average += ((double) analogRead(PINOUT_KB_IN)) / samples; + } + + unsigned int pot_rel = analogRead(PINOUT_POT_REL); + unsigned int pot_atk = analogRead(PINOUT_POT_ATK); + unsigned int pot_wav = analogRead(PINOUT_POT_WAV); + unsigned int kb_in = analogRead(PINOUT_KB_IN); + unsigned char env = pot_rel / (1024/4); + unsigned char mod = 572 + pot_atk / 100; + unsigned char wave = pot_wav / (1024/4); + bernard.setEnvelope(wave, env); + bernard.mTrigger(wave, 116 - average / 10); + delay(500 - pot_atk / 5); } |