Show Posts
Pages: 1 ... 24 25 [26] 27 28 ... 110
376  Using Arduino / Project Guidance / Re: USB MIDI keyboard simple question, is this possible or not? on: December 16, 2013, 12:29:57 pm
Quote
so if I use an arduino for each USB MIDI keyboard I have, would it still be that difficult?
One Arduino per keyboard makes it a whole lot easier. Each one can be compiled to set the velocity to whatever value you like - alternatively it could set a different channel for each one and then it would work with other software too.

Pete
377  Using Arduino / Project Guidance / Re: USB MIDI keyboard simple question, is this possible or not? on: December 16, 2013, 10:15:12 am
One keyboard is relatively easy to do and modifying the midi stream from the keyboard before sending it on to the PC is also easy.
More than one keyboard requires that you write code to merge the data from each keyboard. A Midi message is usually two or more bytes so that you can't just forward the midi bytes as they arrive from the keyboards because you would then jumble them all together. You would have to store the incoming data from each keyboard until you have read a complete midi message, modify it and then send it on its way.
If you use an Arduino MEGA (or a Teensy3/3.1) you will have 3 serial ports you could use for keyboards and then send the data to the PC over USB. I don't think any standard PC software would be able to differentiate between keyboards using only the velocity value. If you only have 3 keyboards, your merger software will know which keyboard is which and can therefore modify the midi info to put each one on a different channel (and can also fix the velocity value).
Possible? yes. But it'll be a fair bit of work.

Pete
378  Using Arduino / Programming Questions / Re: Exponent value on: December 14, 2013, 07:35:09 pm
The integer part of log10() is the exponent.
e.g. log10(.0001) is -4.00

Pete
[edit] typo (I originally typed .00001)
379  Using Arduino / Programming Questions / Re: linear algebra formula on: December 12, 2013, 07:59:31 pm
You can use exp() instead of pow. It should give a more accurate answer.

Pete
380  Products / Arduino Due / Re: I need help with an example. on: December 12, 2013, 05:01:12 pm
Use Windows Explorer to look at the "My Documents\Arduino\WaveformGenerator" directory. It should have two files in it, WaveformGenerator.ino and Waveforms.h
Either Waveforms.h is missing or the filename isn't spelled correctly. If you change the name of the file, or add new files to a directory, you have to close the Arduino IDE and start it up again before it will see any changes.

Pete
381  Using Arduino / Programming Questions / Re: Problems on delay calculation on: December 12, 2013, 04:50:09 pm
If the time is 21:59:58 then there's only two seconds to go before 22:00:00. The calculation is:
Quote
3600 - (59*60 + 58) = 2 seconds
If you do 3600-(59*60 - 58) you get 118 seconds left which is obviously wrong.

Pete
382  Using Arduino / Programming Questions / Re: Problems on delay calculation on: December 12, 2013, 03:05:15 pm
The problem is that this calculation:
Code:
(((now.minute()*60)-now.second())*1000)
is done in 16-bit integer arithmetic. You need to cast it to force the use of unsigned long.
You also should not be subtracting .second.
Try this:
Code:
sleepTime = (3600000UL-(((now.minute()*60UL)+now.second())*1000UL));

Pete
383  Community / Bar Sport / Re: Arduino Template on: December 12, 2013, 02:10:01 pm
Surely you know by now that you should put your code in a code block.
It would also make your code more readable if you first used the IDE menu Tools|Auto Format to indent your code for you.

Pete
384  Using Arduino / Programming Questions / Re: problem compiling "large" project on: December 12, 2013, 01:59:06 pm
I think your separate source files should be .cpp - not .c

Pete
385  Products / Arduino Due / Re: I need help with an example. on: December 12, 2013, 01:12:01 pm
If you are using Windows, the usual place for the directories is "My Documents\Arduino".
The name of the directory must be exactly the same as the .ino file (without the .ino) so you should make a directory called "My Documents\Arduino\WaveformGenerator" and put the two files in there. That will make it easier to find when you start up the Arduino IDE. You should be able to open the File|Sketchbook menu and find WaveformGenerator listed in the dropdown menu.

Pete
386  Products / Arduino Due / Re: I need help with an example. on: December 12, 2013, 12:04:42 pm
Quote
I copied the two, one behind the other in the same sketch
That's the wrong way to do it and is why the first error message is "Waveforms.h: No such file or directory".
Waveforms.h must be a separate file in the same directory as FunctionGenerator.ino

Pete
387  Using Arduino / Programming Questions / Re: logarithmic scaling on: December 12, 2013, 10:33:20 am
How long does your current linear method take to get from stopped to full speed and what is the preset constant?

Quote
the closer it is to full speed the shorter the time between steps is
I'm not sure that this is what you should do - it probably won't look right. I think the acceleration at the beginning and end should be lower than it is in the middle. But you'd have to experiment with it to find the right acceleration curve.

One way to approximate the exponential curve would be to break it into several linear pieces. At the moment, at any point in the acceleration (and, presumably, deceleration) you are using the same linear constant to increase the speed. You could keep track of what stage of the acceleration you are at (as you do now) and map that into one of, say, five constants such as 1, 3, 7, 3 and 1, or whatever is appropriate. If it doesn't take long to get up to full speed I doubt that you'll notice the difference between that and a true exponential.

Pete

 
388  Using Arduino / Sensors / Re: DS18S20 temp sensor won't go below 32F on: December 11, 2013, 12:05:28 pm
The DS18S20 returns the temperature as a twos complement number (as does the DS18B20) so you don't need to test the sign bit. You are just changing all negative numbers to positive ones.

Pete
389  Using Arduino / Programming Questions / Re: Problem with an alarm, tone and a while loop on: December 11, 2013, 12:00:24 pm
If the code enters the while loop, the only for it to exit the loop is if alarma1 is set to zero. This happens only if "ircode == but1". You will have to figure out why ircode never equals but1.

It would help if you used the IDE menu Tools|Auto Format on your code before posting it. Also get rid of most of the blank lines.

Pete
390  General Category / General Discussion / Re: Morse Code blinker on: December 10, 2013, 05:45:25 pm
You'd be a lot better off using an array.

Pete
Pages: 1 ... 24 25 [26] 27 28 ... 110