Pages: [1]   Go Down
Author Topic: Run 2 i2r devices on a Deamilanove similtaneously?  (Read 584 times)
0 Members and 1 Guest are viewing this topic.
Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 183
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thinking of a project where I'll need a Wifi shield and a LCD shield both running together. Is this possible and if so, how?

Jim
Logged

8000ft above the average

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is i2r?
I2c, spi, serial?
Logged

Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 183
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is i2r?
I2c, spi, serial?
of course I meant i2c, sorry.

Jim
Logged

8000ft above the average

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 360
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C is designed for chaining - just connect both devices to the SDA and SCK lines, and make sure they have nonconflicting addresses.
Logged

Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 183
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C is designed for chaining - just connect both devices to the SDA and SCK lines, and make sure they have nonconflicting addresses.

Thanks for the reply! How does the Arduino specify the device address? I assume that means I could stack I2C shields by just giving them different addresses.

Jim
Logged

8000ft above the average

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The wiring.h library is used for I2C. Your program will contain the device address and the data you are sending it.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27144
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the correct thing to call out, I was a little off:
Code:
#include <Wire.h>  // bring in Wire Library

//Then you can set up some addresses to use, these are for MAX6953 for example:

//  I2C device address is 1 0 1   A3 A2 A1 A0  with AD1, AD0 both low
#define COMMAND_ADDRESS (0x50);
#define CONFIG_ADDRESS (0x04);
#define INTENSITY10_ADDRESS (0x01);
#define INTENSITY32_ADDRESS (0x02);
#define SCANLIMIT_ADDRESS (0x03);
#define DIGIT0_ADDRESS (0x60);
#define DIGIT1_ADDRESS (0x61);
#define DIGIT2_ADDRESS (0x62);
#define DIGIT3_ADDRESS (0x63);

and send a command,  I did this in Setup to get ready for Loop:
Code:
void setup() {
  // start up I2C, uses Analog 5 for Clock, Analog 4 for data
  Wire.begin(); // nothing in () because we are the master
/*  Need this stuff now??  Try with & without, Wire.h & Wire.begin might do it for you:

  // define stuff to use for ShiftOut
  // SCL, SDA, BLINK

  //set pins to output so you can control the shift register
  pinMode(Blink, INPUT); // Blink
  pinMode(clockPin, OUTPUT); // SCL
  pinMode(dataPin, OUTPUT);  // SDA
*/

  //  Send config register address
 
  Wire.beginTransmission(address);
  Wire.send(COMMAND_ADDRESS);
  Wire.send(CONFIG_ADDRESS);

  //  Connect to device and the byte
  Wire.send(0x01);  //  low byte

  Wire.endTransmission();

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: