Go Down

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



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

 Mozzi help/discussion/announcements:

    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

// 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!


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?


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



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!


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