Pages

Subscribe:

Ads 468x60px

Labels

2013年7月23日 星期二

LEGO可自動分類 樂高迷恨到口水流

game of life with 8x8 bicolor led matrix

I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infinite grid but on this wrapping 8x8 grid it does ;-) FYI, the LED matrix is a bicolor one (green/red) and has an I2C interface (http://www.adafruit.com/products/902). I'm using the colors as follows: - newly created cells are green - cells that are at least 10 generations old are red - other living cells are yellow (simultaneously green+red) It's hookup up to my Arduino Uno r3. here's a video:Youtube

Code
/*
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infinite grid but on this wrapping 8x8 grid it does ;-)
 
FYI, the LED matrix is a bicolor one (green/red) and has an I2C interface (http://www.adafruit.com/products/902). I'm using the colors as follows:
- newly created cells are green
- cells that are at least 10 generations old are red
- other living cells are yellow (simultaneously green+red)
 
It's hookup up to my Arduino Uno r3.
 
here's a video: http://www.youtube.com/watch?v=Ee2hOaQ2RDI
 
*/
 
#include
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
 
boolean cells[8][8];
 
Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
 
// game of life
int next[8][8];
 
void setup() {
Serial.begin(9600);
Serial.write("hello");
 
randomSeed(analogRead(0));
for (int r=0 ; r<8 r="" span="">
for (int c=0 ; c<8 c="" span="">
if (random(2) >0)
next[r][c] = 1;
}
}
matrix.begin(0x70); // pass in the address
}
 
void loop() {
 
game_of_life();
}
 
int current[8][8] =
{ {0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,1,1,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0} };
int mod(int a) { return (a+8)%8; }
 
void game_of_life() {
matrix.clear();
// draw
for (int r=0 ; r<8 r="" span="">
for (int c=0 ; c<8 c="" span="">
int color;
if (next[r][c] == 0)
color = 0;
else if (next[r][c] == 1)
color = LED_GREEN;
else if (next[r][c] > 10)
color = LED_RED;
else
color = LED_YELLOW;
matrix.drawPixel(c,r,color);
}
}
matrix.writeDisplay();
// calc next state
for (int r=0 ; r<8 r="" span="">
for (int c=0 ; c<8 c="" span="">
// count alive neighbors
int alive = 0;
alive += current[mod(r+1)][mod(c) ] != 0;
alive += current[mod(r) ][mod(c+1)] != 0;
alive += current[mod(r-1)][mod(c) ] != 0;
alive += current[mod(r) ][mod(c-1)] != 0;
alive += current[mod(r+1)][mod(c+1)] != 0;
alive += current[mod(r-1)][mod(c-1)] != 0;
alive += current[mod(r+1)][mod(c-1)] != 0;
alive += current[mod(r-1)][mod(c+1)] != 0;
if (current[r][c])
if (alive < 2 || alive > 3)
next[r][c] = 0;
else
next[r][c] = current[r][c] + 1;
else
if (alive == 3)
next[r][c] = 1;
}
}
for (int r=0 ; r<8 r="" span="">
for (int c=0 ; c<8 c="" span="">
current[r][c] = next[r][c];
}
}
delay(100);
}

A diy pop-up interactive book made with recycled materials

A diy pop-up interactive book made with recycled materials

A DIY magnetic levitation vehicle to inspire future engineers

A DIY magnetic levitation vehicle to inspire future engineers

2013年7月22日 星期一

Build your own Custom Arduino Remote Control and Lego RC Vehicle!!

Do you like Legos?
Do you like Arduinos?
Do you like RC things that you can bring to life with the flick of a thumb?
I certainly do, so today I’ll be showing you how to make something that combines all of the above into one and go over a ton of other useful techniques and best practices as well!


     I’ll start by giving a brief description of what I made, and then I’ll follow with not just how to make it, but the reasons behind it too! By explaining all the steps involved (like the designplanning3D modelling, and even the Lego-building and laser-cutting!) and the decisions and thought process behind those steps (as well as the CAD files and code), I hope not only to share with you what you will need to make what I have, but also useful background and techniques that you can use not only in your own version of this project, but in all your other DIY projects too! Lastly, if there anything that I might have missed or that you need additional information or clarification about, or if you have any questions whatsoever, please feel free to ask me in the comments or to message me! Now lets get started!

    As you might have guessed from the title or seen in the video, the project I've been hinting towards consists of two parts: a completely custom Arduino remote control, and a servo-powered RC Lego car!

   The Lego part of the RC vehicle is a medium-sized chassis built around a Lego drivetrain with four-wheel drive and four-wheel steering. The RC part is a set of four standard hobby servospowering the drivetrain; an Arduino, for controlling everything; and an XBEE radio, for communication with the remote control. There is also an onboard power supply (it’s an RC car! Of course it has one!).

    The second part of the project is the remote control. It’s about the size of a Gameboy Advance; has a 2.2” LCD color display; is built around an Arduino microcontroller; has a joystick, two potentiometers, and four buttons for input; and has the same type of XBEE radio module the RC vehicle does. All of this is housed in a custom enclosure made entirely from laser-cut acrylic. The remote control supports USB cable operation via the serial port on the Arduino, but it can also be operated off a 9V battery which can be mounted onboard, allowing the entire remote to be operated, well, remotely. Fun stuff.

    Now that you know what you’ll be making, we can start actually making it.
Everything you'll need file-wise is available for download on my site, Kayrus.com.
Here's the link: www.kayrus.com/legos/diy_rc_zip (it should download automatically)
Included in the zip file are the latest Inventor part files (.ipt's), the combined AutoCAD drawing (.dwg), and the latest Arduino code for the car and Handuino (.ino's) and I'll let you all know if I make updates or improvements to these!

Proximity Sensing Origami Flower

Origami is the traditional Japanese art of paper folding.  In this project, with a little help from anArduino, you can bring your origami into the 21st century and make it an interactive art!

The result shown here uses Bare Conductive paint to give an origami flower proximity sensing powers.  When you put your hand close by, it triggers a small vibrating motor, and the flower wiggles around to say "hello!".

Submitted by Ace Monster Toys Hackerspace in Oakland, CA for the Instructables Sponsorship Program

動感科技-機器人,全系列計13集,2013/7/21起,每周日上午08:00於華視主頻動感播出



我看了一集多
覺得很不錯

推薦給各位

http://univisionfilmmaker.com/category/robot/