Hi Folks,
I am in need of some help here. I am building a midi mixer for the visually impaired and am using some code that was originally written for an Arduino Due.
The code basically strobes multiple 4067 multiplexer chips (I have designed a 96 way multiplexer board if anyone wants the design please PM me) and then dependant on the value returned ( a variable voltage between 0 and 3.3v for pots and 0 or 3.3v for switches) output a midi message. I have used the code very successfully on other projects but this project requires 44 pots and 33 switches to be scanned which would be pushing the limit of the Arduino whereas the Teensy (4.0) looks it could handle this code and a bit more without breaking a sweat.
Now to the problem;
I have compiled the sketch with a few changes to accommodate the change in the amount of switches and pots but when I try to verify the script the IDE is reporting the following errors;
Arduino: 1.8.10 (Windows 10), TD: 1.48, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
Midi_Multiplexer_backup: In function 'void updateButtons()':
Midi_Multiplexer_backup:205: warning: array subscript is above array bounds
byte message = BUTTONS->getValue();
^
Midi_Multiplexer_backup:209: warning: array subscript is above array bounds
switch (BUTTONS->Bcommand) {
^
Midi_Multiplexer_backup:219: warning: array subscript is above array bounds
BUTTONS->Btoggle = 1;
^
Midi_Multiplexer_backup:223: warning: array subscript is above array bounds
BUTTONS->Btoggle = 0;
^
Midi_Multiplexer_backup:231: warning: array subscript is above array bounds
switch (BUTTONS->Bcommand) {
^
Midi_Multiplexer_backup: In function 'void updatePots()':
Midi_Multiplexer_backup:288: warning: array subscript is above array bounds
byte potmessage = POTS->getValue();
^
Midi_Multiplexer_backup:289: warning: array subscript is above array bounds
if (potmessage != 255) MIDI.sendControlChange(POTS->Pcontrol, potmessage, POTS->Pchannel);
^
C:\Users\User\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'byte Button::getValue()':
Controller.cpp:96: warning: comparison between signed and unsigned integer expressions
if (millis() - _time < _debounce) return 255;
^
C:\Users\rayev\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'void Pot::muxUpdate()':
Controller.cpp:140: error: 'PORTD' was not declared in this scope
if (_numMuxPins > 8) PORTD = PORTD & B11000011;
^
Controller.cpp:141: error: 'PORTD' was not declared in this scope
else PORTD = PORTD & B11100011;
^
Controller.cpp:143: error: 'PORTD' was not declared in this scope
PORTD = PORTD | temp;
^
Multiple libraries were found for "MIDI.h"
Used: C:\Program
Not used: C:\Users\User\OneDrive\Documents\Arduino\libraries\MIDI_Library
'PORTD' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have attached the main code plus the Controller.cpp and Controller.h subscripts
I understand some of the code and am trying to get to grips with the rest but this has me stumped.
One line does spring out though;
C:\Users\User\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'byte Button::getValue()':
Does the part "arduino_build_730605" need to be changed to Teensy?
Any suggestions on how to change this to get it working on the Teensy would be greatly appreciated
Cheers.
I am in need of some help here. I am building a midi mixer for the visually impaired and am using some code that was originally written for an Arduino Due.
The code basically strobes multiple 4067 multiplexer chips (I have designed a 96 way multiplexer board if anyone wants the design please PM me) and then dependant on the value returned ( a variable voltage between 0 and 3.3v for pots and 0 or 3.3v for switches) output a midi message. I have used the code very successfully on other projects but this project requires 44 pots and 33 switches to be scanned which would be pushing the limit of the Arduino whereas the Teensy (4.0) looks it could handle this code and a bit more without breaking a sweat.
Now to the problem;
I have compiled the sketch with a few changes to accommodate the change in the amount of switches and pots but when I try to verify the script the IDE is reporting the following errors;
Arduino: 1.8.10 (Windows 10), TD: 1.48, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
Midi_Multiplexer_backup: In function 'void updateButtons()':
Midi_Multiplexer_backup:205: warning: array subscript is above array bounds
byte message = BUTTONS->getValue();
^
Midi_Multiplexer_backup:209: warning: array subscript is above array bounds
switch (BUTTONS->Bcommand) {
^
Midi_Multiplexer_backup:219: warning: array subscript is above array bounds
BUTTONS->Btoggle = 1;
^
Midi_Multiplexer_backup:223: warning: array subscript is above array bounds
BUTTONS->Btoggle = 0;
^
Midi_Multiplexer_backup:231: warning: array subscript is above array bounds
switch (BUTTONS->Bcommand) {
^
Midi_Multiplexer_backup: In function 'void updatePots()':
Midi_Multiplexer_backup:288: warning: array subscript is above array bounds
byte potmessage = POTS->getValue();
^
Midi_Multiplexer_backup:289: warning: array subscript is above array bounds
if (potmessage != 255) MIDI.sendControlChange(POTS->Pcontrol, potmessage, POTS->Pchannel);
^
C:\Users\User\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'byte Button::getValue()':
Controller.cpp:96: warning: comparison between signed and unsigned integer expressions
if (millis() - _time < _debounce) return 255;
^
C:\Users\rayev\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'void Pot::muxUpdate()':
Controller.cpp:140: error: 'PORTD' was not declared in this scope
if (_numMuxPins > 8) PORTD = PORTD & B11000011;
^
Controller.cpp:141: error: 'PORTD' was not declared in this scope
else PORTD = PORTD & B11100011;
^
Controller.cpp:143: error: 'PORTD' was not declared in this scope
PORTD = PORTD | temp;
^
Multiple libraries were found for "MIDI.h"
Used: C:\Program
Not used: C:\Users\User\OneDrive\Documents\Arduino\libraries\MIDI_Library
'PORTD' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have attached the main code plus the Controller.cpp and Controller.h subscripts
I understand some of the code and am trying to get to grips with the rest but this has me stumped.
One line does spring out though;
C:\Users\User\AppData\Local\Temp\arduino_build_730605\sketch\Controller.cpp: In member function 'byte Button::getValue()':
Does the part "arduino_build_730605" need to be changed to Teensy?
Any suggestions on how to change this to get it working on the Teensy would be greatly appreciated
Cheers.