MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

Ardcore Logic Sketch (a-166 clone)?
MUFF WIGGLER Forum Index -> SNAZZY FX  
Author Ardcore Logic Sketch (a-166 clone)?
silversurfer
Hi all,
Is it possible to clone the doepfer a-166 as an ardcore sketch?
The Logic Module sketch is very close:

Analog In 1: Input 1
Analog In 2: Input 2
Digital Out 1: AND output (HIGH if both on)
Digital Out 2: OR output (HIGH if one is on)
Clock In: Unused
Analog Out: XOR output (all HIGH if only one is on)

The Doepfer a-166 is same but has 3 inputs so as far as I can see, if you can make the 'Clock In' another input it should be there, right?

I don't care about the inverted parts, I can do that with a trigger modifier module.

Doepfer a-166 http://www.emismusic.co.uk/a166.html
eclectics
Yeah that should work. Do you need help with it? Happy to code it up for you if you want.
eclectics
Ok, here you go. Just rename the txt file to ino
Note that if there's nothing attached to the clock it will read as high.
The dac is outputting either 0 or 255 (full).
silversurfer
Hi,
If you don't mind coding it that would be awesome, would really appreciate that, thanks thumbs up

I'd also like to know how you'd do it. I assume you'd just edit the existing Logic Module sketch, rigfht? I've looked at the sketches code but can't see what it is I'd need to edit.

Really wanting to use the ardcore as my main Logic source so this sletch will probably make me buy the expander if it works.
eclectics
Ok, see above -- looks like our posts crossed.
I tend to code my own things, using the framework Darwin made for the most part. I like programming, so it's more fun that way.

In this case we're just reading the inputs and writing the result of the logic function to the outputs. My sketch is slightly out of norm for the framework because I'm setting the analog inputs to a digital mode.

Happy to explain anything you don't understand.

The expander is great because it breaks out the DAC into 8 digital outs-- so with this example you could have them reflect the output of functions of different sets of inputs -- so A2 & A3, A2 ^ clk, etc.
silversurfer
You're a star, thank you. I genuinely appreciate that thumbs up
eclectics
With respect to the Logic Module Sketch,

In the setup you need to set pinMode(2,INPUT) to read the clock pin (this may be the default, not sure). And in the globals add a variable for clkState

Darwin is using 200 rather than 512 to count as logic high for the analog pins. The threshold value might be the sort of thing to get A0 or A1 to set.


Code:


void loop()
{
  anaState[0] = analogRead(analogIn[0]) > 200;
  anaState[1] = analogRead(analogIn[1]) > 200;

//read the clock like
clkState=digitalRead(2);


  digitalWrite(digPin[0], (anaState[0] && anaState[1] && clkState)); //add the clkState
  digitalWrite(digPin[1], (anaState[0] || anaState[1] || clkState));
 
  if (anaState[0] != anaState[1]) { //see note below
    dacOutput(255);
  } else {
    dacOutput(0);
  }
}


So with the XOR output D is testing the 2 arent equal to each other. To carry this on you'ld want a!=b && b!=c && a!=c

You can also use the arduino's xor function which is a^b^c -- but you have to be careful because this is a bitwise operator rather than a logical operator; it works in this case ok because a,b and c are either 1 or 0.
MUFF WIGGLER Forum Index -> SNAZZY FX  
Page 1 of 1
Powered by phpBB © phpBB Group