Hi All,
I'm taking an Audio Electronics course which involves an Arduino UNO. The problem is, the code for this project I'm building was made 5 years ago, and I have no idea how to fix the code to work for Arduino today. The project is a DIY MIDI controller called the SugarCube Synth (https://www.instructables.com/id/Sugarcube-MIDI-Controller/).
After completely copying all of the code that the original builder coded for the project, I still keep getting an error message of:
/var/folders/ly/t44swsyn56ldvv0_12hnp76h0000gn/T//cc44r57c.ltrans0.ltrans.o: In function main': /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:43: undefined reference to
setup'
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp:46: undefined reference to `loop'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
Below is the code I'm trying to upload:
// /*
// StepSequencer.cpp
// Created by Amanda Ghassaei, Mar 2, 2013.
// */
#include "SugarCube.h"
StepSequencer::StepSequencer()
{
_tempoTimer = 0;
_maxTempo = this->maxTempoFromPotVal(_sugarcube->getPot2Val());
_xOffset = xOffsetFromPotVal(_sugarcube->getPot1Val());
_playhead = absolutePosition(15);//start at -1
_velocity = 100;
//change these to change available notes
_notes[3] = 72;
_notes[2] = 67;
_notes[1] = 63;
_notes[0] = 60;
this->clearAllStorage();
}
void StepSequencer::routine100kHz()
{
if (_tempoTimer++>_maxTempo){
_tempoTimer = 0;
this->incrementPlayhead();
}
}
void StepSequencer::buttonPressed(byte xPos, byte yPos)
{
byte colState = _seqStates[this->absolutePosition(xPos)];
if (colState & 1<<(3-yPos)){//if already on
colState &= ~(1<<(3-yPos));//turn off
_sugarcube->turnOffLED(xPos, yPos);
} else {
colState |= (1<<(3-yPos));//turn on
_sugarcube->turnOnLED(xPos, yPos);
}
_seqStates[this->absolutePosition(xPos)] = colState;
}
byte StepSequencer::absolutePosition(byte pos)
{
return (pos+_xOffset)&15;
}
byte StepSequencer::relativePosition()
{
return (_playhead+16-_xOffset)&15;
}
void StepSequencer::pot1HasChanged(int val)
{
_xOffset = xOffsetFromPotVal(val);
for (byte i=0;i<4;i++){
_sugarcube->setLEDCol(i, _seqStates[this->absolutePosition(i)]);
}
if (this->relativePosition()<4) _sugarcube->setLEDCol(this->relativePosition(), 15);//turn on column
}
void StepSequencer::pot2HasChanged(int val)
{
_maxTempo = this->maxTempoFromPotVal(val);
}
byte StepSequencer::maxTempoFromPotVal(int val)//10 bit val
{
return ((val>>6) + 1)*5;
}
void StepSequencer::incrementPlayhead()
{
if (this->relativePosition()<4)_sugarcube->setLEDCol(this->relativePosition(), _seqStates[_playhead]);//set col to original state
this->playNotesForStates(_seqStates[_playhead], false);
_playhead++;
if (_playhead>15) _playhead = 0;
if (this->relativePosition()<4) _sugarcube->setLEDCol(this->relativePosition(), 15);//turn on column
this->playNotesForStates(_seqStates[_playhead], true);
}
void StepSequencer::playNotesForStates(byte column, boolean noteOn)
{
for (byte i=0;i<4;i++){
if (column & 1<<i){
if (noteOn){
_sugarcube->noteOn(_notes*, _velocity);*
- } else {*
_sugarcube->noteOff(notes*);
_ }*
* }*
* }*
* }*
* void StepSequencer::wasShaken()*
* {*
* this->clearAllStorage();*
* for (byte i=0;i<4;i++){*
sugarcube->noteOff(notes*);//turn off any notes that might be stuck on*
* }*
* sugarcube->clearLEDs();
if (this->relativePosition()<4) sugarcube->setLEDCol(this->relativePosition(), 15);//turn on column*
* }*
* void StepSequencer::clearAllStorage()*
* {*
* for (byte i=0;i<16;i++){*
seqStates = 0;
* }
}*
I've included all of the extra .h files I needed.
If anyone has time to look at this, I'd really appreciate the help. My project is due next week, and I'm beginning to panic. I've been trying to figure out how to fix this myself, but I have no idea how to even begin to read any computer code, let alone Arduino code.
Thanks so much in advance._