NRF24L01 Á¦Ç°À» »ç¿ëÇÒ ¶§, SPI¸¦ ¾²Áö ¾Ê°í I2C¸¦ »ç¿ëÇÏ¿© ÀûÀº ¼öÀÇ Á¡ÆÛ¼±À¸·Î ¾ÆµÎÀ̳뿡 ¿¬°áÇÒ ¼ö ÀÖµµ·Ï µ½´Â ½¯µåÀÔ´Ï´Ù.
70m ¼Û¼ö½Å °Å¸® ¾ç¹æÇâ Åë½Å I2C/TWI ÇÁ·ÎÅäÄÝ ¾ÆµÎÀ̳ë ȣȯ 2.4GHz
µÎ ´ëÀÇ ¾ÆµÎÀ̳뿡 ¿¬°áµÈ °³¹ßº¸µå¸¦ ÁغñÇÏ°í, °³¹ßº¸µå À§¿¡ NRF24L01À» 8ÇÉ Çì´õ¿¡ ³¢¿ó´Ï´Ù. ÀÌ ¶§, NRF24L01ÀÇ ¹æÇâÀº PCB¿¡ »õ°ÜÁø ½ÇÅ©½ºÅ©¸°À» ÅëÇØ È®ÀÎÇÒ ¼ö ÀÖÀ¸¸ç, º¸µåÀÇ ¹Ù±ùÂÊÀ¸·Î ±æ°Ô ³¢¿ï ¼ö ÀÖ½À´Ï´Ù.
¾ÆµÎÀ̳ë ÄÚµå (Arduino source code)
¸¶½ºÅÍ/¼Û½ÅºÎ
/* Guide how to use Arduino Wire.h(Wire Library) with 24l01 i2c Module Shield Reads the data from an I2C/TWI slave module device
*/ unsigned char ppt =0; #include //Import the Arduino wire library void setup() { Wire.begin(); // I2c Bus (address optional for master) Serial.begin(9600); // Opening Serial Communication for Reading the Output } unsigned char judge = 0,good;
void loop() { // Reads Wire Master if(judge == 0) { Wire.requestFrom(35, 1); // Requesting 6 bytes from the slave device #2 if(Wire.available()) { good = Wire.read(); // bytes as character if(good !=0x47){ //Serial.println(Good) ; // Optional //Serial.println("Receive") ; // Optional judge = 1; } } } // Write Wire Master if(judge == 1) { Wire.beginTransmission(35); // Send data to device #35 //Wire.write(7); // Optional sends 5 bytes Wire.write(14Core); // transfer character 1 save display "14core" Wire.endTransmission(); // stop sending Serial.println(14Core) ; judge = 0; } delay(100); //Delay
}
½½·¹À̺ê/¼ö½ÅºÎ
/* Tutorial how to use of the Wire library using I2C/TWI & Writes data to an I2C/TWI slave device Refer to the "Wire Slave Receiver" */
#include //import Arduino Wire Library void setup() { Wire.begin(); // Bind i2c bus (address is optional for master) Serial.begin(9600); // Opening Serial Communication for reading the output } unsigned char judge = 0; char scan; void loop() {
if(judge == 0) { Wire.beginTransmission(35); // Send to device #35 //Wire.write(7); // Optional for testing sends five bytes Wire.write(scan); Wire.endTransmission(); // Stop the Transmission judge = 1; } delay(100); if(judge == 1) { Wire.requestFrom(35, 1); // Wire start request 1 byte from the slave module device #35 if(Wire.available()) { unsigned char c = Wire.read(); // Receive byte as Character display Say Hello to www.14core.com if(c !=0x47){ Serial.println(c); ++scan; if(scan == 8) scan = 0; // Scan addresses judge = 0; } } } }
|