DIY sysex fader box status and questions.

tom adam tom.adam at thebigear.be
Tue Apr 24 08:58:37 CEST 2012


Hello,

Current sketch here (not working) 
http://www.thebigear.be/SDIY/sketch_apr23_enc_read_v2.ino
What is does is read some encoders calculate if the encoder goes up or 
down, and than calculate values (that need to be transformed into a 
sysex message, not yet included).

> What do you mean by 'void loop'? And what exactly is your piece of 
> code supposed to do?
The main loop, the part of the program that runs over and over ;-)
>
> Those variables, switchVar and OLDswitchVar, what are they? How are 
> they defined?
As bytes, depending on the read of the encoders.
>
>> SHould I end this function with a return statement? Or is it somehow
>> defined in the syntax?
>
> You use a return statement if you want to return a value, in C that 
> would be a numeric value or a pointer. Do you need to return 
> something, to use in an expression?
Pointer, aha yes, ran into them before... Anyway, I want the function to 
return an array that I than can use for further calculations.
>
>> Next one, how does one do this:
>> oldvalue = value;
>> for an entire array with same length?
>
> int index;
> for( index = 0; index < length; index++ )
>     array[index] = value;
>
> Unless you're copying one array to another, of course.
Yes, I need to copy one array into another. Haven't found a way to do 
that yet.
>
>> Last one, any idea what's wrong with this:
>> for (int n = 0; n <= 3; n++)
>> {
>> int c = OLDvalues1[n];
>> int d = encoders1[n];
>> values1[n] = c + d;
>> values1[n] = OLDvalues1[n];
>> }
>
> The 'values1[n] = c + d' statement is useless, because the next 
> statement overwrites the value of value1[n].
Doh, thanks a lot...
>
>> I should get me a good book about the basics, i guess :-\
>
> Yeah, that's probably a good idea. C is a pretty simple language, but 
> also somewhat primitive and it's easy to shoot yourself in the foot.
>
I read somewhere that C provides you the gun ;-)
ToAd
> - Peter
> _______________________________________________
> music-bar mailing list
> music-bar at lists.music-bar.org
> http://lists.music-bar.org/cgi-bin/mailman/listinfo/music-bar



More information about the music-bar mailing list