Show Posts
Pages: [1] 2
1  International / Hardware / Re: piastre di prototipazione misteriose on: October 22, 2012, 06:17:00 pm
mi ci trovo tanto bene *__*

ok, i pedali mi vengono delle dimensioni di un pedale della sovtek obeso, però perlomeno ci capisco qualcosa. e ato che sono prono agli errori, non mi ci gioco le gambette dei componenti... anche se saldare i condensatori divena un pò un problema.

quindi niente ite? mi adatto alle millefori/veroboard?
2  International / Hardware / piastre di prototipazione misteriose on: October 22, 2012, 05:41:17 pm
lo so, sono un pò offtopic però non sapevo proprio a chi chiedere... ho rinvenuto nel dimenticatoio alcune di queste "piastre" da prototipazione... dato che le trovo molto comode, almeno per circuiti semplici semplici, qualcuno mi sa dire se ne trovo ancora in giro?
grazie smiley
3  International / Software / Re: problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 10:52:03 am
uh... la uno?

no no, io con la programmazione sono a livello ameba. l'importante è che adesso funzioni smiley-grin

più o meno qualcosa ho capito smiley-razz
4  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 08, 2012, 10:49:46 am
well... now it works smiley-grin

i've inserted a code i've found "near here" to make the button act as switch:

Code:
/* ======================================================================
 Arduino Punk Console
 A simple programmable 8 step tone sequencer
 by dano/beavisaudio.com
 Revs
 -----------------------------------
 15 Sept  djh  initial version
======================================================================*/
// Map all the input and output pins
#define AnalogInFrequency 1
#define AnalogInTempo 2
#define AnalogInDuration 0
#define DigitalOutSignal 11
#define DigitalInSwitch0 2
#define DigitalInSwitch1 3
#define DigitalInSwitch2 4
#define DigitalInSwitch3 5
#define DigitalInSwitch4 6
#define DigitalInSwitch5 7
#define DigitalInSwitch6 8
#define DigitalInSwitch7 9
#define DigitalOutLED 1
// Set up the array for each step
int steps[] = {100,120,140,160,180,200,220,240};
// misc housekeeping
int duration = 50;
int pitchval = 1;
int fPlayMode = true;
int lastPushedStep = -1;
int Button = 0; //This is the default "Button Off" and 1 is "Button On"
int OldButton = 0; //I'll explain later
// Initialize the tempo
int tempo = 100;

/* switch
 *
 * Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
 * press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
 * a minimum delay between toggles to debounce the circuit (i.e. to ignore
 * noise). 
 *
 * David A. Mellis
 * 21 November 2006
 */

int inPin = 10;         // the number of the input pin
int outPin = 13;       // the number of the output pin

int state = HIGH;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers



void setup()

{
  // setup pin modes (Digital pins are input by default, but
  // I like to set 'em explicitly just so the code is clear.
  pinMode (DigitalInSwitch0, INPUT);
  pinMode (DigitalInSwitch1, INPUT);
  pinMode (DigitalInSwitch2, INPUT);
  pinMode (DigitalInSwitch3, INPUT);
  pinMode (DigitalInSwitch4, INPUT);
  pinMode (DigitalInSwitch5, INPUT);
  pinMode (DigitalInSwitch6, INPUT);
  pinMode (DigitalInSwitch7, INPUT);
  pinMode (DigitalOutSignal, OUTPUT); 
  pinMode (DigitalOutLED, OUTPUT);
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
  // setup comms for the LCD display
  Serial.begin(9600);
  StartupMessage();
}

void StartupMessage()
{
  clearLCD();
  Serial.print ("BEAVIS: Arduino");
  delay(300);
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("Punk Console!");
  delay (2000);
  clearLCD();
  Serial.print ("Beavis: APC");
}

void clearLCD()
{
  Serial.print(254, BYTE);
  Serial.print(1, BYTE);
}

void loop()
{
  // Main sequence loop 
  for (int i=0; i<8; i++)
  {   
    // Are we playing or stopping?
   {
  reading = digitalRead(inPin);

  // if the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (reading == HIGH && previous == LOW && millis() - time > debounce)
  {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

    time = millis();   
  }

  digitalWrite(outPin, state);

  previous = reading;
}
   
    fPlayMode = digitalRead (13);
    digitalWrite (DigitalOutLED, HIGH);
    // Check the Hardware
     readSwitches();
     readPots();

    // update the display
    updateDisplay();

    // Make the noise
    if (fPlayMode)
    {
      freqout (steps[i], duration);
    }
    digitalWrite (DigitalOutLED, LOW);

    // Pause between steps
    delay (tempo);       
  }
}

void updateDisplay()
{
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("T:");
  Serial.print (tempo);
  Serial.print (" d:");
  Serial.print (duration);
 if (lastPushedStep != -1)
 {
    Serial.print ("*");
    Serial.print (lastPushedStep);
 }
}
// Read the current values of the pots, called from the loop.
void readPots ()
{
    tempo = (analogRead (AnalogInTempo) * 1.9);
    duration = (analogRead (AnalogInDuration));     
}
// Read the current values of the switches and
// if pressed, replace the switch's slot frequency
// by reading the frequency pot.
void readSwitches()
{
  // reset last pushed button number
  lastPushedStep = -1;

  // check switch 0, if pressed, get the current freq into step 0, etc. etc.
  if (digitalRead (DigitalInSwitch0) == HIGH)
  {
    steps[0] = analogRead(AnalogInFrequency);
    lastPushedStep = 1;
  }

  else if (digitalRead (DigitalInSwitch1) == HIGH)
  {
    steps[1] = analogRead(AnalogInFrequency);
    lastPushedStep = 2;
  }

  else if (digitalRead (DigitalInSwitch2) == HIGH)
  {
    steps[2] = analogRead(AnalogInFrequency);
    lastPushedStep = 3;
  }
  else if (digitalRead (DigitalInSwitch3) == HIGH)
  {
    steps[3] = analogRead(AnalogInFrequency);
    lastPushedStep = 4;
  }
  else if (digitalRead (DigitalInSwitch4) == HIGH)
  {
    steps[4] = analogRead(AnalogInFrequency);
    lastPushedStep = 5;
  }
  else if (digitalRead (DigitalInSwitch5) == HIGH)
  {
    steps[5] = analogRead(AnalogInFrequency);
    lastPushedStep = 6;
  }
  else if (digitalRead (DigitalInSwitch6) == HIGH)
  {
    steps[6] = analogRead(AnalogInFrequency);
    lastPushedStep = 7;
  }
  else if (digitalRead (DigitalInSwitch7) == HIGH)
  {
    steps[7] = analogRead(AnalogInFrequency);
    lastPushedStep = 8;
  }
}


//freqout code by Paul Badger
// freq - frequency value
// t - time duration of tone
void freqout(int freq, int t)
{
  int hperiod;     //calculate 1/2 period in us
  long cycles, i;

  // subtract 7 us to make up for digitalWrite overhead - determined empirically
  hperiod = (500000 / ((freq - 7) * pitchval));             

  // calculate cycles
  cycles = ((long)freq * (long)t) / 1000;    // calculate cycles
  for (i=0; i<= cycles; i++)
  {              // play note for t ms 
    digitalWrite(DigitalOutSignal, HIGH); 
    delayMicroseconds(hperiod);
    digitalWrite(DigitalOutSignal, LOW); 
    delayMicroseconds(hperiod - 1);     // - 1 to make up for fractional microsecond in digitaWrite overhead
  }
}

now works smiley

thanks for the hints!
5  International / Software / Re: problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 10:09:54 am
Quote
quì ci sta l'errore. ma immagino che parlarti di funzione non abbia senso

non c'è problema, ho risolto smiley

dato che smanetto con il codice da un giorno e non ho mai mai mai studiato programmazione all'infuori di un pò di TurboPASCAL al liceo, mi ritengo abbastanza soddisfatto!

grazie ancora!
6  International / Software / Re: problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 09:08:40 am
EUREKA!!!!

ho trovato l'errore, con un metodo del tipo cancella-vedi se carica-ctrl+z-e così via...

per un motivo a me sconosciuto, dovevo scrivere:

Code:
void setup()

{
  // setup pin modes (Digital pins are input by default, but
  // I like to set 'em explicitly just so the code is clear.
  pinMode (DigitalInSwitch0, INPUT);
  pinMode (DigitalInSwitch1, INPUT);
  pinMode (DigitalInSwitch2, INPUT);
  pinMode (DigitalInSwitch3, INPUT);
  pinMode (DigitalInSwitch4, INPUT);
  pinMode (DigitalInSwitch5, INPUT);
  pinMode (DigitalInSwitch6, INPUT);
  pinMode (DigitalInSwitch7, INPUT);
  pinMode (DigitalOutSignal, OUTPUT);  
  pinMode (DigitalOutLED, OUTPUT);
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
  // setup comms for the LCD display
  Serial.begin(9600);
  StartupMessage();
}

al posto di:

Code:
void setup()

{
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
}

{
  // setup pin modes (Digital pins are input by default, but
  // I like to set 'em explicitly just so the code is clear.
  pinMode (DigitalInSwitch0, INPUT);
  pinMode (DigitalInSwitch1, INPUT);
  pinMode (DigitalInSwitch2, INPUT);
  pinMode (DigitalInSwitch3, INPUT);
  pinMode (DigitalInSwitch4, INPUT);
  pinMode (DigitalInSwitch5, INPUT);
  pinMode (DigitalInSwitch6, INPUT);
  pinMode (DigitalInSwitch7, INPUT);
  pinMode (DigitalOutSignal, OUTPUT);  
  pinMode (DigitalOutLED, OUTPUT);
  // setup comms for the LCD display
  Serial.begin(9600);

  StartupMessage();
}

per una ragione che assolutamente non comprendo,

Code:
{
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
}

non va bene.

grazie a tutti cmq!!!! smiley-grin
7  International / Software / Re: problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 08:56:21 am
non riesco a capire.

vi comunico il codice e l'errore... sembra che ogni "compilatore" parli una lingua sua :\

questo è il codice
Code:
/* ======================================================================
 Arduino Punk Console
 A simple programmable 8 step tone sequencer
 by dano/beavisaudio.com
 Revs
 -----------------------------------
 15 Sept  djh  initial version
======================================================================*/
// Map all the input and output pins
#define AnalogInFrequency 1
#define AnalogInTempo 2
#define AnalogInDuration 0
#define DigitalOutSignal 11
#define DigitalInSwitch0 2
#define DigitalInSwitch1 3
#define DigitalInSwitch2 4
#define DigitalInSwitch3 5
#define DigitalInSwitch4 6
#define DigitalInSwitch5 7
#define DigitalInSwitch6 8
#define DigitalInSwitch7 9
#define DigitalOutLED 1
// Set up the array for each step
int steps[] = {100,120,140,160,180,200,220,240};
// misc housekeeping
int duration = 50;
int pitchval = 1;
int fPlayMode = true;
int lastPushedStep = -1;
int Button = 0; //This is the default "Button Off" and 1 is "Button On"
int OldButton = 0; //I'll explain later
// Initialize the tempo
int tempo = 100;

/* switch
 *
 * Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
 * press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
 * a minimum delay between toggles to debounce the circuit (i.e. to ignore
 * noise). 
 *
 * David A. Mellis
 * 21 November 2006
 */

int inPin = 10;         // the number of the input pin
int outPin = 13;       // the number of the output pin

int state = HIGH;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers



void setup()

{
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
}

{
  // setup pin modes (Digital pins are input by default, but
  // I like to set 'em explicitly just so the code is clear.
  pinMode (DigitalInSwitch0, INPUT);
  pinMode (DigitalInSwitch1, INPUT);
  pinMode (DigitalInSwitch2, INPUT);
  pinMode (DigitalInSwitch3, INPUT);
  pinMode (DigitalInSwitch4, INPUT);
  pinMode (DigitalInSwitch5, INPUT);
  pinMode (DigitalInSwitch6, INPUT);
  pinMode (DigitalInSwitch7, INPUT);
  pinMode (DigitalOutSignal, OUTPUT); 
  pinMode (DigitalOutLED, OUTPUT);
  // setup comms for the LCD display
  Serial.begin(9600);

  StartupMessage();
}
void StartupMessage()
{
  clearLCD();
  Serial.print ("BEAVIS: Arduino");
  delay(300);
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("Punk Console!");
  delay (2000);
  clearLCD();
  Serial.print ("Beavis: APC");
}

void clearLCD()
{
  Serial.print(254, BYTE);
  Serial.print(1, BYTE);
}

void loop()
{
  // Main sequence loop 
  for (int i=0; i<8; i++)
  {   
    // Are we playing or stopping?
   {
  reading = digitalRead(inPin);

  // if the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (reading == HIGH && previous == LOW && millis() - time > debounce)
  {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

    time = millis();   
  }

  digitalWrite(outPin, state);

  previous = reading;
}
   
    fPlayMode = digitalRead (13);
    digitalWrite (DigitalOutLED, HIGH);
    // Check the Hardware
     readSwitches();
     readPots();

    // update the display
    updateDisplay();

    // Make the noise
    if (fPlayMode)
    {
      freqout (steps[i], duration);
    }
    digitalWrite (DigitalOutLED, LOW);

    // Pause between steps
    delay (tempo);       
  }
}

void updateDisplay()
{
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("T:");
  Serial.print (tempo);
  Serial.print (" d:");
  Serial.print (duration);
 if (lastPushedStep != -1)
 {
    Serial.print ("*");
    Serial.print (lastPushedStep);
 }
}
// Read the current values of the pots, called from the loop.
void readPots ()
{
    tempo = (analogRead (AnalogInTempo) * 1.9);
    duration = (analogRead (AnalogInDuration));     
}
// Read the current values of the switches and
// if pressed, replace the switch's slot frequency
// by reading the frequency pot.
void readSwitches()
{
  // reset last pushed button number
  lastPushedStep = -1;

  // check switch 0, if pressed, get the current freq into step 0, etc. etc.
  if (digitalRead (DigitalInSwitch0) == HIGH)
  {
    steps[0] = analogRead(AnalogInFrequency);
    lastPushedStep = 1;
  }

  else if (digitalRead (DigitalInSwitch1) == HIGH)
  {
    steps[1] = analogRead(AnalogInFrequency);
    lastPushedStep = 2;
  }

  else if (digitalRead (DigitalInSwitch2) == HIGH)
  {
    steps[2] = analogRead(AnalogInFrequency);
    lastPushedStep = 3;
  }
  else if (digitalRead (DigitalInSwitch3) == HIGH)
  {
    steps[3] = analogRead(AnalogInFrequency);
    lastPushedStep = 4;
  }
  else if (digitalRead (DigitalInSwitch4) == HIGH)
  {
    steps[4] = analogRead(AnalogInFrequency);
    lastPushedStep = 5;
  }
  else if (digitalRead (DigitalInSwitch5) == HIGH)
  {
    steps[5] = analogRead(AnalogInFrequency);
    lastPushedStep = 6;
  }
  else if (digitalRead (DigitalInSwitch6) == HIGH)
  {
    steps[6] = analogRead(AnalogInFrequency);
    lastPushedStep = 7;
  }
  else if (digitalRead (DigitalInSwitch7) == HIGH)
  {
    steps[7] = analogRead(AnalogInFrequency);
    lastPushedStep = 8;
  }
}


//freqout code by Paul Badger
// freq - frequency value
// t - time duration of tone
void freqout(int freq, int t)
{
  int hperiod;     //calculate 1/2 period in us
  long cycles, i;

  // subtract 7 us to make up for digitalWrite overhead - determined empirically
  hperiod = (500000 / ((freq - 7) * pitchval));             

  // calculate cycles
  cycles = ((long)freq * (long)t) / 1000;    // calculate cycles
  for (i=0; i<= cycles; i++)
  {              // play note for t ms 
    digitalWrite(DigitalOutSignal, HIGH); 
    delayMicroseconds(hperiod);
    digitalWrite(DigitalOutSignal, LOW); 
    delayMicroseconds(hperiod - 1);     // - 1 to make up for fractional microsecond in digitaWrite overhead
  }
}

e questo è l'errore:

Code:
sketch_oct06a_pippo.cpp:76:1: error: expected unqualified-id before ‘{’ token


solo che le righe 75-76-77 sono queste:

Code:

pinMode (DigitalInSwitch5, INPUT);
pinMode (DigitalInSwitch6, INPUT);
pinMode (DigitalInSwitch7, INPUT);

e nessuna traccia di parentesi graffe :\
8  International / Software / Re: problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 08:06:23 am
il bello è che adesso il codice originale del sito adesso non va più.

LOL.

una divinità superiore ed alquanto burlona ha cambiato la pagina nottetempo?
9  International / Software / problema con l'incorporazione di un codice (sto esplodendo) on: October 08, 2012, 07:39:16 am
heilà.

qualche giorno fa mi sono messo a fare una roba semplice con arduino: il sequencer che vedete in questa pagina

http://www.beavisaudio.com/projects/digital/arduinopunkconsole/


solo che il codice ha un bug: il pulsante Start/Stop non fa la funzione che dice di fare (devo tenerlo premuto per far uscire il suono).

allora mi sono messo alla ricerca ed ho trovato questo:

http://www.arduino.cc/en/Tutorial/Switch


dato che presi singolarmente i due codici "funzionano", ne ho dedotto che avrei potuto incorporare il codice dello switch nel codice del sequencer, così da avere risolto il problema.
come? copiando il codice e cercando di evitare collisioni tra i pin utilizzati in comune nei due codici. tipo muovendo il controllo dello switch al pin 10, e dicendo al sequencer di guardare cosa succede al pin 13 per sapere se far partire il sequencer o meno.

E INVECE NO! una volta incorporato, ricevo uno o due errori di "unexpected unqualified-id before { token" e non riesco a localizzarlo... ma credo che il problema stia nel modo in cui incorporo il codice dello switch...

...e non capiso il perchè :\

...un aiutino su come "mergere" i due codici?
Grazie!
grazie!!!!
10  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 07, 2012, 07:49:27 pm
I'm quite out of ideas here.

I've corrected the "grammar" of the code, but it's not behaving like I would like.

with the original code, the function "fPlayMode" work only if i keep the start/stop button pressed.

code is here: http://www.beavisaudio.com/projects/digital/arduinopunkconsole/

with this coding, it starts automatically, some seconds after power up the arduino:

Code:
/* ======================================================================
 Arduino Punk Console
 A simple programmable 8 step tone sequencer
 by dano/beavisaudio.com
 Revs
 -----------------------------------
 15 Sept  djh  initial version
======================================================================*/
// Map all the input and output pins
#define AnalogInFrequency 1
#define AnalogInTempo 2
#define AnalogInDuration 0
#define DigitalOutSignal 11
#define DigitalInSwitch0 2
#define DigitalInSwitch1 3
#define DigitalInSwitch2 4
#define DigitalInSwitch3 5
#define DigitalInSwitch4 6
#define DigitalInSwitch5 7
#define DigitalInSwitch6 8
#define DigitalInSwitch7 9
#define DigitalInStartStop 10
#define DigitalInPippo 12
#define DigitalOutLED 13
// Set up the array for each step
int steps[] = {100,120,140,160,180,200,220,240};
// misc housekeeping
int duration = 50;
int pitchval = 1;
int fPlayMode = true;
int lastPushedStep = -1;
// Initialize the tempo
int tempo = 100;
void setup()
{
  // setup pin modes (Digital pins are input by default, but
  // I like to set 'em explicitly just so the code is clear.
  pinMode (DigitalInSwitch0, INPUT);
  pinMode (DigitalInSwitch1, INPUT);
  pinMode (DigitalInSwitch2, INPUT);
  pinMode (DigitalInSwitch3, INPUT);
  pinMode (DigitalInSwitch4, INPUT);
  pinMode (DigitalInSwitch5, INPUT);
  pinMode (DigitalInSwitch6, INPUT);
  pinMode (DigitalInSwitch7, INPUT);                
  pinMode (DigitalInStartStop, INPUT);
  pinMode (DigitalOutSignal, OUTPUT);  
  pinMode (DigitalOutLED, OUTPUT);
  // setup comms for the LCD display
  Serial.begin(9600);

  StartupMessage();
}
void StartupMessage()
{
  clearLCD();
  Serial.print ("BEAVIS: Arduino");
  delay(300);
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("Punk Console!");
  delay (2000);
  clearLCD();
  Serial.print ("Beavis: APC");
}

void clearLCD()
{
  Serial.print(254, BYTE);
  Serial.print(1, BYTE);
}

void loop()
{
  // Main sequence loop  
  for (int i=0; i<8; i++)
  {  
    // Are we playing or stopping?
    if (digitalRead ((DigitalInStartStop) == HIGH))
    {
      if (digitalRead((DigitalInPippo) == LOW))
      {
        digitalWrite(DigitalInPippo, HIGH);
      }
      else
      {
        digitalWrite(DigitalInPippo, LOW);
      }
    }
    fPlayMode = digitalRead (DigitalInPippo);
    digitalWrite (DigitalOutLED, HIGH);
    // Check the Hardware
     readSwitches();
     readPots();

    // update the display
    updateDisplay();

    // Make the noise
    if (fPlayMode)
    {
      freqout (steps[i], duration);
    }
    digitalWrite (DigitalOutLED, LOW);

    // Pause between steps
    delay (tempo);      
  }
}

void updateDisplay()
{
  Serial.print (254, BYTE);
  Serial.print (192, BYTE);
  Serial.print ("T:");
  Serial.print (tempo);
  Serial.print (" d:");
  Serial.print (duration);
 if (lastPushedStep != -1)
 {
    Serial.print ("*");
    Serial.print (lastPushedStep);
 }
}
// Read the current values of the pots, called from the loop.
void readPots ()
{
    tempo = (analogRead (AnalogInTempo) * 1.9);
    duration = (analogRead (AnalogInDuration));      
}
// Read the current values of the switches and
// if pressed, replace the switch's slot frequency
// by reading the frequency pot.
void readSwitches()
{
  // reset last pushed button number
  lastPushedStep = -1;

  // check switch 0, if pressed, get the current freq into step 0, etc. etc.
  if (digitalRead (DigitalInSwitch0) == HIGH)
  {
    steps[0] = analogRead(AnalogInFrequency);
    lastPushedStep = 1;
  }

  else if (digitalRead (DigitalInSwitch1) == HIGH)
  {
    steps[1] = analogRead(AnalogInFrequency);
    lastPushedStep = 2;
  }

  else if (digitalRead (DigitalInSwitch2) == HIGH)
  {
    steps[2] = analogRead(AnalogInFrequency);
    lastPushedStep = 3;
  }
  else if (digitalRead (DigitalInSwitch3) == HIGH)
  {
    steps[3] = analogRead(AnalogInFrequency);
    lastPushedStep = 4;
  }
  else if (digitalRead (DigitalInSwitch4) == HIGH)
  {
    steps[4] = analogRead(AnalogInFrequency);
    lastPushedStep = 5;
  }
  else if (digitalRead (DigitalInSwitch5) == HIGH)
  {
    steps[5] = analogRead(AnalogInFrequency);
    lastPushedStep = 6;
  }
  else if (digitalRead (DigitalInSwitch6) == HIGH)
  {
    steps[6] = analogRead(AnalogInFrequency);
    lastPushedStep = 7;
  }
  else if (digitalRead (DigitalInSwitch7) == HIGH)
  {
    steps[7] = analogRead(AnalogInFrequency);
    lastPushedStep = 8;
  }
}


//freqout code by Paul Badger
// freq - frequency value
// t - time duration of tone
void freqout(int freq, int t)
{
  int hperiod;     //calculate 1/2 period in us
  long cycles, i;

  // subtract 7 us to make up for digitalWrite overhead - determined empirically
  hperiod = (500000 / ((freq - 7) * pitchval));            

  // calculate cycles
  cycles = ((long)freq * (long)t) / 1000;    // calculate cycles
  for (i=0; i<= cycles; i++)
  {              // play note for t ms  
    digitalWrite(DigitalOutSignal, HIGH);  
    delayMicroseconds(hperiod);
    digitalWrite(DigitalOutSignal, LOW);  
    delayMicroseconds(hperiod - 1);     // - 1 to make up for fractional microsecond in digitaWrite overhead
  }
}

and all the clever ideas out there to make a on/off toggle seems not to adapt to my case.
I'd really grateful is someone could help me figuring out to make this thing work, so that i can close the case and move on another project. after all, it's just the very last button that doesn't work...
11  International / Generale / Re: Presentazioni nuovi iscritti, fatevi conoscere da tutti! on: October 07, 2012, 07:00:30 pm
Ciao a tutti!

mi chiamo Massimiliano (Max), vengo dai pressi di Torino e sono un laureando in Ecodesign. Designer di giorno e musicista di notte a seconda del fuso orario, mi sono interessato ad arduino durante la mia prima tesi, parlando dell'open source.

da musicista mi sono avvicinato al mondo dei sintetizzatori, e dai synth modulari all'elettronica per principianti il passo è breve. quando poi cominci a trovare interessante il white noise credo che lo stato ti dovrebbe pagare perlomeno un indennizzo sugli psicofarmaci smiley-grin

arduino mi interessa proprio per le sue potenzialità in ambito "musicale"... riuscissi anche solo a creare ciascun modulo di un synth analogico con arduino, sarebbe sempre solo + o - una cinquantina di euro a modulo. cercate i prezzi dei Buchla e capirete...

al momento sto costruendo una roba semplice semplice, un clone dell'Atari Punk Console (visibile qui: http://www.beavisaudio.com/projects/digital/ArduinoPunkConsole/ ) ma ho qualche problema col codice, a cui sto cercando una risposta qui http://arduino.cc/forum/index.php/topic,125895.0.html

Giau!
12  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 07, 2012, 01:45:29 pm
also, an idea that came into my mind but it's incorrect and i can't understand why:

Code:
// Are we playing or stopping?
    {
  if(digitalRead(10, HIGH)  //If Pin 10 is high i press the control button, then check:
    if (digitalRead((13) == LOW) //if the pin13 is LOW
    {
    digitalWrite(13, HIGH) //then make it HIGH (button pressed)
    }
    if (digitalRead((13) == HIGH) //if the pin13 is HIGH
    {
    digitalWrite(13, LOW) //then release it
    }
    fPlayMode = digitalRead (13);

thanks again!
13  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 07, 2012, 01:07:11 pm
I've found *something*, googling around... now it stays silen until i press the button, but for some reason pressing it again won't deactivate the pin 13 (called DigitalInPippo).

here's the code i'e found and adapted:

Code:
{
  if(digitalRead(10) == HIGH) { //If Pin 10 is high (At 5 Volts)
    Button = 1 - Button; //If Button is set as 0 then Button = 1 - 0 (=1) and if Button is 1 then Button=1 - 1 (=0)
  }
 
  if(Button == 1 && OldButton == 0) { //If Button is 1 and OldButton is 0 (This means basically means "If the button was just pressed"
     digitalWrite (DigitalInPippo, HIGH);//Put what you want to happen when the "Switch" is on here
     delay(500); //Delay for half a second
  }
 
  if(Button == 0 && OldButton == 1) {
    digitalWrite (DigitalInPippo, LOW);//Put what you want to happen when the "Switch" is off here
    delay(500); //Delay for half a second
  }

  OldButton = Button; //The data is now old
}

    fPlayMode = digitalRead (DigitalInPippo); //this should activate/deactivate the sounds


any help?
14  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 06, 2012, 09:07:01 am
I think that the code is quite old, right? for instance, when i check the code it keeps telling me that "BYTE" is no more used.
15  Using Arduino / Project Guidance / Re: (another) arduino sequencer thread. on: October 06, 2012, 08:37:56 am
at least now I have a trace, but I don't have any clue about how to code it. any help?
Pages: [1] 2