Archives  

Çϵå¿þ¾î ±¸ÀÔó / shop list

¿Â¶óÀÎ

wiring/arduino º¸µå ±¸ÀÔ
http://www.sparkfun.com/

Àü±â, ÀüÀÚºÎǰ
»ùÇÃÀüÀÚ(ÁÖ·Î ¼¾¼­) http://www.sample.co.kr
¿¤·¹ÆÄÃ÷ http://www.eleparts.co.kr
µð¹ÙÀ̽º¸¶Æ® http://www.devicemart.co.kr
½ºÆÄÅ©ÆÝ(ÇØ¿Ü) http://www.sparkfun.com/


¿ÀÇÁ¶óÀÎ
»ùÇÃÀüÀÚ(¿ë»ê ÀüÀÚ·£µå ±¤ÀåÃþ ÀÔ±¸)
SYÀüÀÚ(¿ë»ê ÀüÀÚ·£µå ±¤ÀåÃþ ÀÔ±¸)

February 12, 2008 5:19 PM |

LED backpack(arduino)

IMG_9529.jpg
IMG_9530.jpg
IMG_9531.jpg
sparkfun LED backpack(7 colors)
http://www.arduino.cc/playground/Code/RGBBackpack

// Simple program to test using the Arduino with the RGB Matrix 
// & Backpack from Sparkfun. Code is a combination of Heather Dewey-Hagborg,
// Arduino Forum user: Little-Scale, and // Daniel Hirschmann. Enjoy!
// 
// The Backpack requires 125Khz SPI, which is the slowest rate 
// at which the Arduino's hardware SPI bus can communicate at. 
// 
// We need to send SPI to the backpack in the following steps:
// 1) Activate ChipSelect; 
// 2) Wait 500microseconds;
// 3) Transfer 64bytes @ 125KHz (1 byte for each RGB LED in the matrix);
// 4) De-activate ChipSelect;
// 5) Wait 500microseconds
// Repeat however often you like!


#define CHIPSELECT 10//ss
#define SPICLOCK  13//sck
#define DATAOUT 11//MOSI / DI
#define DATAIN 12//MISO / DO

int data[] = 
{0,0,0,0,0,0,0,0,
0,0,1,1,0,1,1,0,
0,1,0,0,1,0,0,1,
0,1,0,0,0,0,0,1,
0,0,1,0,0,0,1,0,
0,0,0,1,0,1,0,0,
0,0,0,0,1,0,0,0,
0,0,0,0,0,0,0,0
}

char spi_transfer(volatile char data)
{
  SPDR = data;			  // Start the transmission
  while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
  {
  };
}

void setup()
{
  byte clr;
  pinMode(DATAOUT,OUTPUT);
  pinMode(SPICLOCK,OUTPUT);
  pinMode(CHIPSELECT,OUTPUT);
  digitalWrite(CHIPSELECT,HIGH); //disable device

  SPCR = B01010001;		 //SPI Registers
  SPSR = SPSR & B11111110;	//make sure the speed is 125KHz

  /*
  SPCR bits:
   7: SPIEE - enables SPI interrupt when high
   6: SPE - enable SPI bus when high
   5: DORD - LSB first when high, MSB first when low
   4: MSTR - arduino is in master mode when high, slave when low
   3: CPOL - data clock idle when high if 1, idle when low if 0
   2: CPHA - data on falling edge of clock when high, rising edge when low
   1: SPR1 - set speed of SPI bus
   0: SPR0 - set speed of SPI bus (00 is fastest @ 4MHz, 11 is slowest @ 250KHz)
   */

  clr=SPSR;
  clr=SPDR;
  delay(10);
}

void loop()		
{
    delay(100);
    int index = 0;			 
    digitalWrite(CHIPSELECT,LOW); // enable the ChipSelect on the backpack
    delayMicroseconds(500);
    for (int i=0;i<8;i++) for (int j=0;j<8;j++)
    {
	spi_transfer(data[index]);
        index++;	   	    
// There are only 8 colours available to the matrix with the 
// backpack, so this will present 1 colour per column on the matrix
    }
    digitalWrite(CHIPSELECT,HIGH); // disable the ChipSelect on the backpack
    delayMicroseconds(500);
}

January 2, 2008 6:37 PM |

wiring/arduino + flash

Download file:flash_io.zip
ÀÚ¼¼ÇÑ ³»¿ëÀº readmeÆÄÀÏÀ» ÂüÁ¶

flash_wiring.png

January 2, 2008 12:31 AM |

Powered by Movable Type 3.34