Show Posts
Pages: [1] 2
1  Using Arduino / Audio / Re: Thoughts on a costum midi controller (what should I use) on: November 13, 2013, 01:03:33 pm
the analog in/output is for lets say dry/wet effect so how bigger the value how intenser the effect its going to be

the data sended and received by the arduino is purly midi messages ( with channel information control information and the intense value)

the software side is not realy an issue, I have done some tests before and it works like a charm (but with serial to midi conversion)

now i'm looking for a micro controller that has a build-in midi capability over usb (no external serial to midi conversion or extra programs running to do this conversion)

maybe some IC's to expand the analog and digital in/outputs

I'm asking this because I don't to much experience with hardware and I want to do it right from the first time so I don't spent a lot of money on the wrong components
2  Using Arduino / Audio / Thoughts on a costum midi controller (what should I use) on: November 12, 2013, 05:53:58 pm
Hey guys and girls,

I'm having this idea to create a midi controller that works with Resolume Arena 4.
For you guys that don't know resolume, its a VJ program, you can see it as a mixing software for video clips

I did some thinking and first off all I'm going to have a lot of analog and digital components to give you guy's a list:
  • 28 x Pot-meter (analog in)
  • 3x Red LED (analog out)
  • 3x Green LED (analog out)
  • 5x Slide Pot-meter (analog in)
  • 48 x Push buttons (digital in)
  • 48 x R LEDs (indiactors) (digital out)

I draw something very quickly in photoshop so you can see where all the components come


Now my questions are:

whats the best board I use for this (a cheap as possible solution in general please) and is there some thinks I need to watch on like example external power supply for all the LEDs, extra ICs for port expansion etc.

not to forget: I want this build to be work with midi and it has to be midi over USB,(no Serial to MIDI conversion)
the VJ software takes a lot of resources so I don't want to waste any more cpu time on serial to MIDI conversion

I hope you guys can set me off on the right track

Grtz Thyvo
3  Using Arduino / Audio / Re: Controlling traktor pro using Arduino issue MIDI on: November 16, 2012, 11:47:58 am
EDIT: sorry I messed up somehow you may delete this post moderator smiley-grin
4  Using Arduino / Audio / Controlling traktor pro using Arduino issue MIDI on: November 16, 2012, 11:45:49 am
Hey there, I wish to create a midi controller to control the remix decks of traktor pro.

but I have a few issues with sending the midi signals
I use Hairless, as midi to serial bridge http://projectgus.github.com/hairless-midiserial/

the problem I'm getting is that I get kind of corrupt data, I'm using the midi library http://www.arduino.cc/playground/Main/MIDILibrary

I recored a video where I show you whats my problem.

Please watch video in 1080p so you can see the warnings and the code



if you don't wish to wast 3 minutes of your life.
I'm getting uncomplete midi data according to Hairless and if I check in traktor, the notes constantly switches (see video around 55sec).

Error message from hairless:
Code:
Warning: got a status byte when we were expecting 1(some times it says 2) more data bytes, sending incomplete MIDI Message 0x80 (this last may change also)

my arduino code is found here: http://pastebin.com/qZyVqCFp

I hope someone knows the solution to my problem smiley-grin

Grtz Tom. aka Thyvo
5  Using Arduino / Programming Questions / Re: Serial to MIDI without MIDI shield on: January 04, 2012, 07:04:55 pm
After 3days, noone  smiley-cry
6  Using Arduino / Programming Questions / Serial to MIDI without MIDI shield on: January 02, 2012, 12:41:57 pm
I'm looking for software to convert my data sended by arduino to MIDI messages the computer can work with.

I found http://spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html

I tried there demo sketch but I did not managed it to get to work (the TX light keeps flashing red),

someone hase experience with this software? or know something simular (for mac)

thanks in advanced,

Thyvo
7  Using Arduino / Installation & Troubleshooting / Re: Sketches Not Uploading To Mega on: January 02, 2012, 11:15:45 am
I'm having a the same problem
8  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 11:52:52 am
Code:
  strings[0] = strtok(command, " ");
   strings[1] = strtok(NULL, " ");
should become:
Code:
  strings[0] = strtok(command, " ");
   strings[1] = strtok(NULL, " ");
   Serial.print("Code: ");
   Serial.println(strings[0]);
   Serial.print("Value: ");
   Serial.println(strings[1]);
so you can see what was received and parsed.

Quote
command is 6 big, (maybe I can set it to 5 and remove command[6] = '\0'
Absolutely, unequivocally, no! command had been 10 elements. Why did you change it?

Code:
  led = atoi(strings[0]);
   power = strtol(strings[1],&pEnd,16);
   Serial.println(strings[1]); //just for debugging
It would make a lot more sense to print led and power!

I did what you said, and I found out by setting the serial monitor to no line endings, alwase responds

basically everything on the arduino side works now, grate, thanks for the help and information, I learned a few new things, thanks smiley-grin

now I can start programming my software in java for it, still need to figure out how that works
9  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 11:17:55 am
And how big is command?

command is 6 big, (maybe I can set it to 5 and remove command[6] = '\0'smiley-wink
10  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 11:11:31 am
What is the last index of command?
Code:
command[6] = '\0';
11  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 10:48:24 am
If you are always sending two values, the while loop is not needed, The strtok() function is, as I mentioned earlier, much easier to use.

Code:
strings[0] = strtok(command, " ");
strings[1] = strtok(NULL, " ");

p and str are not needed. string is not needed. i is not needed.

pEnd is not needed, either. Use NULL in it's place.

Quote
only 1 more thing, sometimes if I enter for example 03 00 to set blue led to low its takes the 03 for the blue led but also 03 as dimming value or it taks the wrong led, or I have to resend the message again, any idea what cause this and how to fix it,
More meaningful printing would probably reveal where the problem is. But, one thing that you need to keep in mind is that the string functions, like strtol() and strtok() expect strings as arguments, not arrays of characters. The difference between a string and an array of characters is that a string is an array of characters THAT IS NULL TERMINATED. You are not NULL terminating the array of characters, so it is not a string. That can adversely impact the string functions.

Add
Code:
command[6] = '\0';
after the for loop when there is serial data to read.

Quote
also I want my message of (setting red to: 255) only shown 1 time
Then move the } after the if(Serial.available() > 5) farther down. All the string parsing and printing and pin manipulation should only be done when there is serial data received.

I did the things you told me
the messages are only shown one time now, added the null

still the problem of I told before still exists
Quote
only 1 more thing, sometimes if I enter for example 03 00 to set blue led to low its takes the 03 for the blue led but also 03 as dimming value or it taks the wrong led, or I have to resend the message again, any idea what cause this and how to fix it,

and I found a new bug,
if I do 04 FF(set all leds full power) and than do 04 95 they al go out

Current code:

Code:

int i = 0;
char *strings[2];
char * pEnd;
char string[32];
char command[6];
int pRed = 4;
int pGreen = 3;
int pBlue = 2;
int led = 0;
int power = 0;
bool feedback = true;
void setup()
{
 Serial.begin(9600);
 pinMode(pRed, OUTPUT);
 pinMode(pGreen,OUTPUT);
 pinMode(pBlue,OUTPUT);
}

void loop(){
  if (Serial.available() >= 5 ) // wait for 5 characters
  {  
for(int i=0; i < 5; i++)
  command[i] = Serial.read();
            command[6] = '\0';
 
    
   strings[0] = strtok(command, " ");
   strings[1] = strtok(NULL, " ");
  
   delay(10);
   led = atoi(strings[0]);
   power = strtol(strings[1],&pEnd,16);
   Serial.println(strings[1]); //just for debugging
   switch(led){
     case 1:
       analogWrite(pRed,power);
       if(feedback == true){
         Serial.print("setting red to: ");
         Serial.println(power);
       }
       led = 0;
       power = 0;
       break;
     case 2:
       analogWrite(pGreen,power);
       if(feedback == true){
         Serial.print("setting green to: ");
         Serial.println(power);
       }
       led = 0;
       power = 0;
       break;
     case 3:
       analogWrite(pBlue,power);
       if(feedback == true){
         Serial.print("setting blue to: ");
         Serial.println(power);
       }
       led = 0;
       power = 0;
       break;
     case 4:
       analogWrite(pRed,power);
       analogWrite(pGreen,power);
       analogWrite(pBlue,power);
       if(feedback == true){
         Serial.print("setting all to: ");
         Serial.println(power);
       }
       led = 0;
       power = 0;
       break;
   }  
   }
}
12  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 09:22:02 am
Code:
    while ((str = strtok_r(p, " ", &p)) != NULL){ // delimiter is the space
     strings[i] = str;
     i++;
   }
Where do you ever reset i?

It is possible to print strings to the serial monitor, too, so that the stuff that is printed has some meaning.

thanks  smiley resetting the i fixed the gibberish returns in the serial monitor,

Code:
  switch((int)strings[0]){
Casting a character to an int is not the way to make a number from a string. You've been told how to do it properly. (The atoi() or strtol() functions, depending on whether the text contains HEX characters or not).

that solved it  smiley thanks for your help

my code works now

only 1 more thing, sometimes if I enter for example 03 00 to set blue led to low its takes the 03 for the blue led but also 03 as dimming value or it taks the wrong led, or I have to resend the message again, any idea what cause this and how to fix it,
also I want my message of (setting red to: 255) only shown 1 time

for ppl who are intressed in my code:

Code:

int i = 0;
char *strings[2];
char * pEnd;
char string[32];
char command[10];
int pRed = 4;
int pGreen = 3;
int pBlue = 2;
int led = 0;
int power = 0;

void setup()
{
 Serial.begin(9600);
 pinMode(pRed, OUTPUT);
 pinMode(pGreen,OUTPUT);
 pinMode(pBlue,OUTPUT);
}

void loop(){
  if (Serial.available() >= 5 ) // wait for 5 characters
  { 
for(int i=0; i < 5; i++)
   command[i] = Serial.read();
   } 
 
     char *p = command;
     char *str;
     
     while ((str = strtok_r(p, " ", &p)) != NULL){ // delimiter is the space
     strings[i] = str;
     i++;
     }
   i = 0;
   
   delay(10);
   /*
   //Serial.println("------------------------------");
   Serial.println(strings[0]);
   Serial.println(strings[1]);
   Serial.println(atoi(strings[0]));
   Serial.println(strtol(strings[1],&pEnd,16));
   Serial.println("------------------------------");
   */
   led = atoi(strings[0]);
   power = strtol(strings[1],&pEnd,16);
   switch(led){
     case 1:
       analogWrite(pRed,power);
       Serial.print("setting red to: ");
       Serial.println(power);
       led = 0;
       power = 0;
       break;
     case 2:
       analogWrite(pGreen,power);
       Serial.print("setting green to: ");
       Serial.println(power);
       led = 0;
       power = 0;
       break;
     case 3:
       analogWrite(pBlue,power);
       Serial.print("setting blue to: ");
       Serial.println(power);
       led = 0;
       power = 0;
       break;
     case 4:
       analogWrite(pRed,power);
       analogWrite(pGreen,power);
       analogWrite(pBlue,power);
       Serial.print("setting all to: ");
       Serial.println(power);
       led = 0;
       power = 0;
       break;
       
   }
     
}
13  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 08:34:02 am
Code:
    while ((str = strtok_r(p, " ", &p)) != NULL){ // delimiter is the space
strtok_r() is the threadsafe version of strtok(). On a single-threaded machine, why do you find it necessary to use the more complicated, larger, thread-safe version?


I don't know I'm googleing and I found this, tryed it and it worked
I'm noobish to arduino and C/C++
I'm gona try it to let it work with strtok(), gona do some googleing for it

this is the code I have so far, my first 5 sec the data given back is normal after that its al junk

ps. I'm trying to create a rgb led controller over serial 01 FF for red led at 255, 02 DD for  green led at 221
Code:
char sz[32] = "01 FF";
int i = 0;
char *strings[2];
char * pEnd;
char string[32];
char command[10];
int pRed = 4; //I'm using a arduino mega
int pGreen = 3;
int pBlue = 2;
char led=0;
int power = 0;

void setup()
{
 Serial.begin(9600);
 pinMode(pRed, OUTPUT);
 pinMode(pGreen,OUTPUT);
 pinMode(pBlue,OUTPUT);
}

void loop(){
  if (Serial.available() >= 5 ) // wait for 5 characters
  {  
for(int i=0; i < 5; i++)
  command[i] = Serial.read();
   }  
  
     char *p = command;
     char *str;
    
     while ((str = strtok_r(p, " ", &p)) != NULL){ // delimiter is the space
     strings[i] = str;
     i++;
   }
  
   //Serial.println(strings[0]);                      IGNORE THIS
   //Serial.println((int)strtol(strings[1],&pEnd,16));
  
   //led = (int)strings[0];
   //power = (int)strtol(strings[1],&pEnd,16);
   //Serial.println("led\t"+led);
   //Serial.println("power\t"+power);
  
   delay(1000);//delay of 1 second
   Serial.println(strings[0]);
   Serial.println(strings[1]);
   Serial.println((int)strtol(strings[0],&pEnd,16));
   Serial.println((int)strtol(strings[1],&pEnd,16));
   Serial.println("------------------------------");
   delay(100);
   switch((int)strings[0]){
     case 1:
       analogWrite(pRed,(int)strtol(strings[1],&pEnd,16));
       led = 0;
       break;
     case 2:
       analogWrite(pGreen,(int)strtol(strings[1],&pEnd,16));
       led = 0;
       break;
     case 3:
       analogWrite(pBlue,(int)strtol(strings[1],&pEnd,16));
       led = 0;
       break;
   }
      
}
Currently I have no leds working

and my given feedback from the serial monitor is strange

Code:
Ä //havent sent any data to the arduino
Ä
0
0
------------------------------
Ä
Ä
0
0
------------------------------

Ä
0
0
------------------------------

Ä
0
0
------------------------------

Ä
0
0
------------------------------ //sended 01 FF to arduino
01
FF
1
255
------------------------------
01
FF
1
255
------------------------------ // and from here it screws up
@
FF
0
255
------------------------------
@@BEFHÓMMêQQ:RWF

BEFHÓMMêQQ=RWF

0
0
------------------------------
@@BEFH!RMSVQuRW@

BEFH"RMSVQuRW@

0
0
------------------------------
@@BEFHqVM½ZQ3RW@@[\^`bdfhjlnprtvxz|~€‚„†ˆŠŒŽ’•ˆŠŒŽ’•ˆŠŒŽ’•ˆŠŒŽ’•ˆŠŒŽ’•ˆŠ
BEFHÔVM&[QzRW@@[\^`bdfhjlnprtvxz|~€‚„†ˆŠŒŽ’•prtvxz|~€‚„†ˆŠŒŽ’•prtvxz|~€‚„†'
0
0
------------------------------
// it keeps going on for a endless list of this kind of stuff
14  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 28, 2011, 06:41:09 am
I create my the part of my code (it works) that splits my string and converts the hex to dec
Code:

char input[32] = "01 FF"; //as demo I'm sending "01 FF", for now its a constant value
int i = 0;
char *strings[2];
char * pEnd;
char string[32];

void setup()
{
 Serial.begin(9600);
}

void loop(){
     char *p = input;
     char *str;
     
     while ((str = strtok_r(p, " ", &p)) != NULL){ // delimiter is the space
     strings[i] = str;
     i++;
   }
   Serial.println(strings[0]);
   Serial.println(strtol(strings[1],&pEnd,16));
   delay(1000);
}
still need to find something to recieve my data from the serial port (that works, I tried a few things but it sended back some gibberish data)
15  Using Arduino / Programming Questions / Re: Arduino recieving hexadecimal data on: December 27, 2011, 03:04:27 pm
Oke, i get that now, but

I still need to find a methode to get all the data until \n witch wil be something like 01 FF or 02 4D (with the \n on behind it)
and split those 2 values from the received string to 2 dec values like 2 (from 02) and 77 (from 4D)
Pages: [1] 2