Post by saltatempo on Mar 15, 2024 23:44:19 GMT
Hi people, here it is my last creation: a diy 2U module programmable (in the same way as you program GRAINS). Six Square Waves at the same time (all the same frequency 490 Hz, sorry about that...) with 6 indipendent PWM modulations, settable with dedicated knobs. At zero position you have a no modulation, increasing knob position you can accelerate the PWM modulation.
// PWM su tutti i 6 pin ATmega328p
int x = 0; int xAmount = 0;
int y = 0; int yAmount = 0;
int z = 0; int zAmount = 0;
int a = 0; int aAmount = 0;
int b = 0; int bAmount = 0;
int c = 0; int cAmount = 0;
void setup() {
Serial.begin(9600);
pinMode(3, OUTPUT); pinMode(5, OUTPUT);
pinMode(6, OUTPUT); pinMode(9, OUTPUT);
pinMode(10, OUTPUT); pinMode(11, OUTPUT);
}
void loop() {
analogWrite(3, x); // pin 5 su ATmega
analogWrite(5, y); // pin 11 su ATmega
analogWrite(6, z); // pin 12 su ATmega
analogWrite(9, a); // pin 15 su ATmega
analogWrite(10, b); // pin 16 su ATmega
analogWrite(11, c); // pin 17 su ATmega
xAmount = analogRead(A0); //Serial.println(xAmount);
xAmount = xAmount * 10 / 1023; //Serial.println(xAmount);
x = x + xAmount;
if (x <= 0 || x >= 255) {
xAmount = -xAmount;
}
yAmount = analogRead(A1); //Serial.println(yAmount);
yAmount = yAmount * 10 / 1023; //Serial.println(yAmount);
y = y + yAmount;
if (y <= 0 || y >= 255) {
yAmount = -yAmount;
}
zAmount = analogRead(A2); //Serial.println(zAmount);
zAmount = zAmount * 10 / 1023; //Serial.println(zAmount);
z = z + zAmount;
if (z <= 0 || z >= 255) {
zAmount = -zAmount;
}
aAmount = analogRead(A3); //Serial.println(aAmount);
aAmount = aAmount * 10 / 1023; //Serial.println(aAmount);
a = a + aAmount;
if (a <= 0 || a >= 255) {
aAmount = -aAmount;
}
bAmount = analogRead(A4); //Serial.println(bAmount);
bAmount = bAmount * 10 / 1023; //Serial.println(bAmount);
b = b + bAmount;
if (b <= 0 || b >= 255) {
bAmount = -bAmount;
}
cAmount = analogRead(A5); //Serial.println(cAmount);
cAmount = cAmount * 10 / 1023; //Serial.println(cAmount);
c = c + cAmount;
if (c <= 0 || c >= 255) {
cAmount = -cAmount;
}
//int t = analogRead(A1); Serial.println(t);
//t = map(t, 0 , 1023 ,0 , 2000); Serial.println(t);
//Serial.println(millis());
//delay(t);
delay(1);
}
// Fonte esempio Fade.ino
Clear skies with your sounds!