Sammy1Am / MoppyClassic

Moppy has been replaced with Moppy 2.0!
568 stars 190 forks source link

Second Arduino Issues #183

Open Sammy1Am opened 6 years ago

Sammy1Am commented 6 years ago

@Renarix said:

I have another issue.... I got secound arduino today. Just uploaded code to arduino. Went in moppy program and for channel 11 switched to Com4 and nothing works. Light on arduino blinks. Wiring is correct because when i change channel 1 from Com3 to com4 everything works. Strange... Com3 is my main arduino.

Sammy1Am commented 6 years ago

Channel 11 will still be channel 11 when it arrives at your second Arduino, which means your Arduino would in theory try to play those notes from the drive connected to pins 22 and 23. However out of the box, the code only supports 8 drives.

You can work around this by modifying the Arduino code on the second Arduino to subtract e.g. 20 from the pin information received over serial. This should shift channel 11 (pin 22) down to channel 1 (pin 2).

Version 2.0 that I'm working on will include the ability to do this sort of channel shifting in the control GUI so you won't have to go changing as much code, but it's still a ways off from being generally usable.

Renarix commented 6 years ago

Well... i will wait for moppy 2 because im too weak at programming..

MuffyTarkin commented 6 years ago

@Renarix Here is a link to a modified Moppy code. Extract and upload the sketch in the first folder to your first Arduino (the one for drives 1-8). Upload the sketch in the second folder to the second Arduino (the one for drives 9-16).

This code also features a slight adjustment to the track length arrays. I changed them from bytes to integers so that if you decide to add something in the future like a scanner, you can more easily adjust the specific track length the Arduino will assign to that pin before shifting directions.

Renarix commented 6 years ago

@MuffyTarkin thank you!

Renarix commented 6 years ago

oh wait. When i try to upload you code it shows this error: Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Renars\Desktop\arduino\UNO Moppy 1\Uno_Moppy_1\Uno_Moppy_1.ino:8:0: warning: "RESOLUTION" redefined

define RESOLUTION 40 //Microsecond resolution for notes

^

In file included from C:\Users\Renars\Desktop\arduino\UNO Moppy 1\Uno_Moppy_1\Uno_Moppy_1.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\TimerOne/TimerOne.h:42:0: note: this is the location of the previous definition

define RESOLUTION 65536 // Timer1 is 16 bit

^

C:\Users\Renars\Desktop\arduino\UNO Moppy 1\Uno_Moppy_1\Uno_Moppy_1.ino: In function 'void setup()':

Uno_Moppy_1:74: error: 'CurieTimerOne' was not declared in this scope

CurieTimerOne.initialize(RESOLUTION); // Set up a timer at the defined resolution

^

exit status 1 'CurieTimerOne' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

MuffyTarkin commented 6 years ago

@Renarix ah crap, I thought I fixed that. I guess it didn't save. If you do a find and replace in both sketches, find CurieTimerOne and replace all with TimerOne. That code was also modified for using Arduino 101's but I thought I edited it back to work with a regular Uno. Guess it didn't save. Weird.

Renarix commented 6 years ago

There is something wrong in your code. When i try to play music head doesnt move back and forward. It just go in one direction. Original code works flawlessly

Lothean commented 6 years ago

@Renarix Should be fixed