Tekforums

Chat => Entertainment & Technology => Topic started by: knighty on January 22, 2012, 18:10:27 PM

Title: c++
Post by: knighty on January 22, 2012, 18:10:27 PM
my nephew wrote this to run on my ardino thigie..... but it doesen't work....

int counter = 1;
int no = 1;
int del = 100;
int del2 = 1000;

void setup() {               
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
}

void loop() {
  counter++;
  no=counter;
  if (no >= 1024);{digitalWrite(2, HIGH);no = no-1024;}delay(del);
  if (no >= 512);{digitalWrite(3, HIGH);no = no-512;}delay(del);
  if (no >= 256);{digitalWrite(4, HIGH);no = no-256;}delay(del);
  if (no >= 128);{digitalWrite(5, HIGH);no = no-128;}delay(del);
  if (no >= 64);{digitalWrite(6, HIGH);no = no-64;}delay(del);
  if (no >= 32);{digitalWrite(7, HIGH);no = no-32;}delay(del);
  if (no >= 16);{digitalWrite(8, HIGH); no = no-16;}delay(del);
  if (no >= 8);{digitalWrite(9, HIGH); no = no-8;} delay(del);
  if (no >= 4);{digitalWrite(10, HIGH); no = no-4;}delay(del);
  if (no >= 2);{digitalWrite(11, HIGH); no = no-2;}delay(del);
  if (no >= 1);{digitalWrite(12, HIGH);no = no-1;}delay(del);
  delay(del2);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
}




digitalwrite(3, high)

puts power to pin 3 on the board turning it on, low turns it off (there's an led attached to each one)

right now.... it just runs through turning all the led's on every time ?

it's supposed to count up in binary  8)


(p.s. my little nephew write it, which is why it's pretty simple, no loops etc.... i told him i could fix it but it's been years cince i did any c, now I'm lost!)
Title: Re: c++
Post by: knighty on January 22, 2012, 19:05:22 PM
fixed it, bad if statment



  if (no >= 1024);{digitalWrite(2, HIGH);no = no-1024;}delay(del);

should have been

  if (no >= 1024){digitalWrite(2, HIGH);no = no-1024;}delay(del);


:-)
Title: Re: c++
Post by: XEntity on January 23, 2012, 23:17:44 PM
Perhaps you could do a guide on the Arduino, I've been interested in them since they have came out but thought it would be far beyond my ability, I could see it becoming useful if you could hook up some relays and have it monitoring inputs, movement sensors and the like :)

Or maybe I could stop being so lazy and actually read up on them!
Title: Re: c++
Post by: knighty on January 24, 2012, 06:40:26 AM
Quote from: XEntity on January 23, 2012, 23:17:44 PM
Perhaps you could do a guide on the Arduino, I've been interested in them since they have came out but thought it would be far beyond my ability, I could see it becoming useful if you could hook up some relays and have it monitoring inputs, movement sensors and the like :)

Or maybe I could stop being so lazy and actually read up on them!

I will.... once I work out how to do something better than flash an led on/off !

they're pretty simple tbh

I'm going to build one of these with my nephew... http://www.youtube.com/watch?v=6mXM-oGggrM

then build one using tri colour leds,

then we're planning a 24x24x24 one :-)



well we were planning a 24x24x24 one.... because the biggest one so far was 16x16x16..... but now some Chinas company has done 32x32x32 so we might have to aim bigger :o
Title: Re: c++
Post by: XEntity on January 24, 2012, 21:52:40 PM
that's freekin awesome, let us know how you get on :P
Title: Re: c++
Post by: knighty on February 05, 2012, 02:05:22 AM
built it earlier on with my nephew.... got kinda distracted and only just realised it's 2am and way way past his bed time :-o

http://imageshack.us/clip/my-videos/706/5gn.mp4/

http://imageshack.us/clip/my-videos/845/v5tg.mp4/

http://imageshack.us/clip/my-videos/718/e2n.mp4/

http://imageshack.us/clip/my-videos/716/5du.mp4/


4x4x4... it's a bit small to do anything really cool on... but was good for practice before we make a BIG one :-)
Title: Re: c++
Post by: XEntity on February 05, 2012, 02:12:23 AM
Nice work, do you have to build the cube, or do people sell them?
Title: Re: c++
Post by: knighty on February 05, 2012, 02:17:53 AM
Quote from: XEntity on February 05, 2012, 02:12:23 AMNice work, do you have to build the cube, or do people sell them?

I think you can buy them ready done... but we built this one... LEDS from and a bit of board from ebay and that was all we needed
(few bits of wire etc...)


at the moment they're all powered directly from the ardinuo... there's 16 positive connections (one for each pillar) and 4 negative connections (one for each layer)

much bigger and you start to need to use LED driver chips... they're pretty simple... and we were going to use them this time for the practice but we soldered the cube up with the positive connections going down the pillars and the negative going across the layers... but the chips I bought are the other way around (doh) so didn't use them in the end

I might mess around with something simple on a chip to try it out... I don;t want to solder up 500+ led's and then realise it's wrong :-(
Title: Re: c++
Post by: M3ta7h3ad on February 05, 2012, 12:58:46 PM
Don't bother with a plain old arduino mate, get a nanode. They're great, arduino based but with onboard ethernet or wireless :) (not 802.1 though, they're xbees I think.

My main toy of choice though is the teensy 2.0 again arduino based but tiny.

Sent from my GT-I9000 using Tapatalk
Title: Re: c++
Post by: knighty on February 05, 2012, 19:34:29 PM
I saw those... but I got the ardino mega 256 (iirc) which has 56 digital input/output ports whcih is more than pretty much anything else has iirc


when I make a massive cube I don;t think any of these little ardino type things will be fast enough for it (to refresh thousands of leds fast enough so you can't see it)

I've been looking at those parralax chips for that... can;t remember the spec off the top of my head but I think they're a couple of hundred Mhz with 8 corse  (instead of these single core 16/32Mhz boards
Title: Re: c++
Post by: Dave on February 05, 2012, 21:35:07 PM
That is pretty awesome - I'd be very into getting into this... I presume you can connect these to IR transmitters etc... have got an IR dimmer switch I was thinking of fitting in my lounge - was looking at getting something like redeye and then controlling TV, lights etc.. from my iphone but it might be more fun to try and play around with/build this stuff myself.
Title: Re: c++
Post by: knighty on February 06, 2012, 03:30:03 AM
yeah, you can get all sorts of things for it pretty much off the shelf

wifi, bluetooth, network, temp/humidity sensors, accelerometers, electronic compass thing I can;t remember the name or, ir transmitters/receivers, motor controller boards etc. etc. etc.

the list is endless :-)
Title: Re: c++
Post by: M3ta7h3ad on February 07, 2012, 01:38:29 AM
Thing is though when are you ever going to have 56 things running on it? :) even the largest midi controllers I've seen have been made using a teensy 2.0++.

Parallax are the chips slated to take the world by storm, but I'm still excited about the raspberrypi, if only from a micro htpc system. for $25 it's worth a punt.

I have both a nanode ( kind of stuck for ideas at the moment to use it, might play with making it a sensor service of some kind) and the teensy2.0 (not the ++, prefer the smaller factor of the 2.0) and I can't stop thinking of ideas for that :)

Http://www.pjrc.com in case you fancy checking out the various projects folks have done, or buying one.

At the moment I have a prototype spooks style dlp-bypass tool.

Its slow and flaky but I've successfully transferred "hello world" style ascii text, audio and image files using it, without the computer seeing it as removable storage.

We've proven the concept, just a case of getting it together enough to present at a conference or talk before anyone else beats us to it, just we're always stupid busy so have no time to push the development faster. :(



Sent from my GT-I9000 using Tapatalk
Title: Re: c++
Post by: knighty on February 07, 2012, 02:47:12 AM
I'm using about 20 of the outputs right now.... but I'm not using any controller chips for the leds...  which I will have to hen the cube gets bigger....

I thought I might be able to speed the cube refresh rate up by connecting the different controller chips to different outputs on the board... (normally you daisy chain them like usb hubs)

a 10x10x10 cube has 1000 leds in it.... and each one needs refreshing 60times a second... so 60,000 updates a second is quite a few for these small chips :o

(and I want to go much bigger than that)

I'll take a look at those other boards you mentioned and maybe have a play with them too :-)
Title: Re: c++
Post by: XEntity on April 19, 2012, 20:51:47 PM
Saw this, check it out...

http://hackaday.com/2012/04/06/the-best-led-cube-build-weve-seen/ (http://hackaday.com/2012/04/06/the-best-led-cube-build-weve-seen/)