Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumWiring HardwareTangible computing › I want to use Multiple Wiring board

Page Index Toggle Pages: 1
I want to use Multiple Wiring board (Read 2870 times)
10/15/06 at 18:22:46

before30   Offline
YaBB Newbies
I Love YaBB 2!
Seoul korea

Posts: 1
*
 
HI~

I want to use 3 or more wiring board at once.
one board act master and others act slave..

I saw the lib and make some programs

the master is

void setup()
{
  Wire.begin();
  Serial.begin( 9600 );
}

void loop()
{
  Wire.requestFrom( 2, 2 );


  while( Wire.available() )
  {
    char c = Wire.receive();
    Serial.print(c);
//if c is not null act something!!!
  }
 
  Wire.requestFrom( 3, 2 );
  while( Wire.available() )
  {
    char c = Wire.receive();
    Serial.print("3 ");
    Serial.print(c);
//if c is not null act something!!!
  }
 
  Serial.println("aaa");
//do something!!!
  delay(500);
}


and make slave

void setup()
{
  Wire.begin( 2 );
  Wire.onRequest( requestEvent );
  Wire.onReceive( receiveEvent );
}

void loop()
{
  delay( 100 );
}

void receiveEvent(int howMany)
{
  while(1 < Wire.available())   {
    char c = Wire.receive();   }
  int x = Wire.receive();    
  Wire.send( "hello2" );
}

void requestEvent()
{
  Wire.send("hello1");
}

but it doesn't work.. Sad
what's wrong in these code?

master pin 0 link slave pin 0
master pin 1 link slave pin 1
if i want to use  TWI, does it right?

I am sorry about my poor english.
Smiley Thanks anyway~ have a good day!
 
IP Logged
 
Reply #1 - 10/21/06 at 01:03:35

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
I'll look into your code.
 
IP Logged
 
Page Index Toggle Pages: 1