Ardcore Logic Sketch (a-166 clone)?

Discussion and Support for our Atmospheric Modification Devices.

Moderators: Kent, infradead, loss1234

Post Reply
User avatar
silversurfer
Common Wiggler
Posts: 195
Joined: Mon Nov 21, 2011 8:21 am

Ardcore Logic Sketch (a-166 clone)?

Post by silversurfer » Mon Nov 17, 2014 5:18 pm

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

User avatar
eclectics
Wiggling with Experience
Posts: 360
Joined: Sat Oct 05, 2013 10:32 am
Location: Melbourne

Post by eclectics » Wed Nov 19, 2014 4:38 am

Yeah that should work. Do you need help with it? Happy to code it up for you if you want.

User avatar
eclectics
Wiggling with Experience
Posts: 360
Joined: Sat Oct 05, 2013 10:32 am
Location: Melbourne

Post by eclectics » Wed Nov 19, 2014 6:38 am

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).
You do not have the required permissions to view the files attached to this post.

User avatar
silversurfer
Common Wiggler
Posts: 195
Joined: Mon Nov 21, 2011 8:21 am

Post by silversurfer » Wed Nov 19, 2014 6:42 am

Hi,
If you don't mind coding it that would be awesome, would really appreciate that, thanks :tu:

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.

User avatar
eclectics
Wiggling with Experience
Posts: 360
Joined: Sat Oct 05, 2013 10:32 am
Location: Melbourne

Post by eclectics » Wed Nov 19, 2014 7:13 am

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.

User avatar
silversurfer
Common Wiggler
Posts: 195
Joined: Mon Nov 21, 2011 8:21 am

Post by silversurfer » Wed Nov 19, 2014 7:20 am

You're a star, thank you. I genuinely appreciate that :tu:

User avatar
eclectics
Wiggling with Experience
Posts: 360
Joined: Sat Oct 05, 2013 10:32 am
Location: Melbourne

Post by eclectics » Wed Nov 19, 2014 7:27 am

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: Select all


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.

Post Reply

Return to “SNAZZY FX”