hello iam trying to make a digital synth i made a rough ui for a oled display (128x64) but when i add mozzi i get the errors In function twi_init': (.text+0x0): multiple definition of
__vector_24' and first defined here
collect2.exe: error: ld returned 1 exit status i think it has something to do with timers but dont know for sure thx alot
Post your entire program in a code block </>
#include <Wire.h>
#include "PCF8591.h" // https://github.com/overbog/PCF8591
#include "MozziGuts.h"
#include "U8glib.h"
PCF8591 pcf8591(0x48,0);
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);
int pot;
int pot2;
int pot3;
int pot4;
int oldVal3;
int val;
int barSize;
int barSize2;
int barSize3;
int barSize4;
int barSize4Procent;
double y;
double i;
double time;
double oldTime;
bool volumeMenuShow = false;
////////////////////////////////////////////////////////////////
void setup() {
startMozzi();
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
int oldVal3 = analogRead(A3);
Wire.begin();
pcf8591.begin();
u8g.setFont(u8g_font_6x10);
u8g.setColorIndex(1); // Instructs the display to draw with a pixel on.
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}
void loop() {
pot = analogRead(A0);
pot2 = analogRead(A1);
pot3 = analogRead(A2);
pot4 = analogRead(A3);
barSize = map(pot, 0, 1023, 0, 100);
barSize2 = map(pot2, 0, 1023, 5, 122);
barSize3 = map(pot3, 0, 1023, 0, 100);
barSize4 = map(pot4, 0, 1023, 0, 127);
barSize4Procent = map(barSize4, 0, 127, 0, 100);
int diff = abs(barSize4 - oldVal3);
if(diff >= 2 && time-oldTime <= 1000) {
time = millis();
oldVal3 = barSize4;
volumeMenuShow = true;
oldTime = time;
} else {
volumeMenuShow = false;
time = 0;
oldTime = time;
}
u8g.firstPage();
do {
if (volumeMenuShow == true) {
u8g.drawStr(10,10,"Volume:");
u8g.setPrintPos(55, 10);
u8g.print(barSize4Procent);
u8g.drawBox(0,27,barSize4,10);
} else if (barSize <= 25) {
u8g.drawLine(0, 32, 63, 0);
u8g.drawLine(63, 0, 63, 63);
u8g.drawLine(63, 63, 127, 32);
} else if (barSize > 25 && barSize <= 50) {
u8g.drawLine(0, 32, 32, 0);
u8g.drawLine(32, 0, 96, 63);
u8g.drawLine(96, 63, 127, 32);
} else if (barSize > 50 && barSize <= 75) {
u8g.drawLine(0, 0, 0, 63);
u8g.drawLine(0, 0, barSize2, 0);
u8g.drawLine(barSize2, 0, barSize2, 63);
u8g.drawLine(barSize2, 63, 127, 63);
} else if (barSize > 75 && barSize <= 100) {
for (i=0; i<=127; i++) {
y = round(-sin(i/128*360 * M_PI / 180) * 128*63/256);
u8g.drawPixel(i, y+32);
}
}
}
while( u8g.nextPage() );
}
code ^^^
C:\Users\xyz\AppData\Local\Temp\arduino-sketch-46E99FEDF9BC32524453F70248C513B2\libraries\Mozzi-master\twi_nonblock.cpp.o (symbol from plugin): In function `initialize_twi_nonblock()':
(.text+0x0): multiple definition of `__vector_24'
C:\Users\xyz\AppData\Local\Temp\arduino-sketch-46E99FEDF9BC32524453F70248C513B2\libraries\Wire\utility\twi.c.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
errors ^^^
There is a compatibility issue between your Mozziguts library and the Wire library.
how can i use them both at the same time? or cant i?
Mozziguts might already use Wire. Try commenting out the include for Wire.
This is an interrupt vector (which one depends on the processor). This is a linker error telling you there are 2 things in your code trying to attach themselves to the same interrupt (ie, there is a clash). Usually this is not an easy fix unless you can find an alternative library that uses another interrupt.
I need mozzi bc i think there is no other capable synthesis lib but is there a alternativr to wire?
Looks like the Mozzi library has its own Two Wire Interface (I2C) library built-in:
libraries\Mozzi-master\twi_nonblock.cpp
Ow oke thx
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.