Pages: [1]   Go Down
Author Topic: Arduino+Srf08+I2c  (Read 902 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bonjour!
Je voudrais savoir comment choisir une adresse au capteur ultrason Srf08.
J'ai essayé ce programme mais cela ne change pas l'adresse.
Pouvez vous m'indiquer la démarche précise à faire pour réussir à choisir ca propre adresse.

/*
// The following code changes the address of a Devantech Ultrasonic Range Finder (SRF10 or SRF08)
// usage: changeAddress(0x70, 0xE6);

void changeAddress(byte oldAddress, byte newAddress)
{
  Wire.beginTransmission(oldAddress);
  Wire.send(0x00);
  Wire.send(0xA0);
  Wire.endTransmission();

  Wire.beginTransmission(oldAddress);
  Wire.send(0x00);
  Wire.send(0xAA);
  Wire.endTransmission();

  Wire.beginTransmission(oldAddress);
  Wire.send(0x00);
  Wire.send(0xA5);
  Wire.endTransmission();

  Wire.beginTransmission(oldAddress);
  Wire.send(0x00);
  Wire.send(newAddress);
  Wire.endTransmission();
}

*/

merci  smiley
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 39
Posts: 3597
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Je connais pas trop l'I2C mais voila ce que j'ai trouvé sur cet engin :
Quote
160 0xA0 1st in sequence to change I2C address
165 0xA5 3rd in sequence to change I2C address
170 0xAA 2nd in sequence to change I2C address

Or toi au lieu de 0xA0 -> 0xA5 -> 0xAA tu as 0xA0 -> 0xAA -> 0xA5
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Non, ca ne marche pas.
J'ai essayé dans les 2 ordres.
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 39
Posts: 3597
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Et pour oldadress tu prends bien 0xE0 ?
Logged


Pages: [1]   Go Up
Jump to: