Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Syntax >> Array of objects..
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1210602062

Message started by julienb on 05/12/08 at 14:21:02

Title: Array of objects..
Post by julienb on 05/12/08 at 14:21:02
Hello!!

I cannot understand why this declaration doesn't work :


Code:
led[][] leds = new led[8][8]  ;

class led {
 int x,y;
 int state;
 int color;
 
 
 led (int xi, int yi, int statei, int colori) {  
   x = xi;
   y = yi;
   state = statei;
   color = colori;
 }
 
 void ledOff()
 {
   state = 0;
 }

 void ledOn()
 {
   state = 1;
 }

 void ledBlink()
 {
   state = 2 ;
 }
}


is it the same problem of "not finished array implementation" ??

Title: Re: Array of objects..
Post by barragan on 05/12/08 at 15:29:26
Wiring is not Java, to give you an idea Wiring is to C++ as Processing is to Java, here is the source code of different libraries for you to look at:
http://wiring.uniandes.edu.co/source/trunk/wiring/lib/Stepper/Stepper.cpp?revision=412&view=markup this one is the stepper motor library, but all of them are there for you to llok at. I will post later today an example for creating your own.

Title: Re: Array of objects..
Post by julienb on 05/12/08 at 15:35:47
I hadn't understood that (I may be a  big newbie)

I coded a lot of things in Processing, and, I didn't really change anything in Wiring style code since today..
And I'm discovering that :)

I'll sleep a little bit less stupid tonight :p
thanks for the link !!

I'm going to post another topic about Serial Data protocol.

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.