Go Down

Topic: Cant find the pin functions in Mozzi library (Read 866 times) previous topic - next topic

Drorz1

Halo!

Im very new with Arduino and I start using Mozzi library.

I cant find the pin functions there.

For example, here is a code the sending a sine signal to pin 9, but where is the pin function, where is included and how can I change it ?

//*  Example playing a sinewave at a set frequency,
    using Mozzi sonification library.

    Demonstrates the use of Oscil to play a wavetable.

    Circuit: Audio output on digital pin 9 on a Uno or similar, or
    DAC/A14 on Teensy 3.1, or
    check the README or http://sensorium.github.com/Mozzi/

    Mozzi documentation/API
 https://sensorium.github.io/Mozzi/doc/html/index.html

 Mozzi help/discussion/announcements:
    https://groups.google.com/forum/#!forum/mozzi-users

    Tim Barrass 2012, CC by-nc-sa.
*/

#include <MozziGuts.h>
#include <Oscil.h> // oscillator template
#include <tables/sin2048_int8.h> // sine table for oscillator

// use: Oscil <table_size, update_rate> oscilName (wavetable), look in .h file of table #included above
Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin(SIN2048_DATA);

// use #define for CONTROL_RATE, not a constant
#define CONTROL_RATE 64 // Hz, powers of 2 are most reliable


void setup(){
  startMozzi(CONTROL_RATE); // :)
  aSin.setFreq(440); // set the frequency
}


void updateControl(){
  // put changing controls in here
}


int updateAudio(){
  return aSin.next(); // return an int signal centred around 0
}


void loop(){
  audioHook(); // required here
}


Thanks a lot!

Grumpy_Mike

Quote
how can I change it
Don't think you can. That pin is a PWM output from one of the timers. It will be set up by a bit of poking at registers. Because that pin is in effect connected to internal hardware its function is fixed and can't be changed in this processor.

Why do you want to change it?

Drorz1

Ok. In case that I dont need to change the output pin, How can I change the input pin in Mozzi ?


Grumpy_Mike


gilshultz

Image result for Mozzi schematic
This should answer your question. I looked up the schematic for Mozzi, this is what I found. Other then that I am not familiar with it.
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

Grumpy_Mike

This should answer your question.
No it will not.
The question was:-
Ok. In case that I dont need to change the output pin, How can I change the input pin in Mozzi ?
So in what way is that an input to Mozzi, it is the output which I already told him about.

Go Up