Hi guys,
It s the first time for me in the forum and my knowledge are quite low in electronics, so please be patient!
The matter is this
I connected an ultrasonic ranger (SRF02, www.robot-electronics.co.uk/htm/srf02techSer.htm) to arduino, and in works, but it has a
working angle outside which doesn t recognize object obviusly.
So I thought about creating a support to join more sensors able to scan all 360.
To do that I need, first, to change addresses of the single sensors,the get each one one different and here is the problem.
The program I written doesn t get errors, but doesn t change the address.
Below the program (in which I m trying to switch from 0xE0, the default address to 0xE1)
#include "Wire.h"
int currentDeviceId = 0xE0;
int newDeviceId = 0xE1;
void setup()
{
Serial.begin(9600);
Wire.begin();
configureDeviceId;
}
void loop()
{
Serial.println(newDeviceId);
}
void configureDeviceId(int currentDeviceId, int newDeviceId)
{
Wire.beginTransmission(currentDeviceId);
Wire.write(0x00);
Wire.write(0xA0);
Wire.endTransmission();
Wire.beginTransmission(currentDeviceId);
Wire.write(0x00);
Wire.write(0xAA);
Wire.endTransmission();
Wire.beginTransmission(currentDeviceId);
Wire.write(0x00);
Wire.write(0xA5);
Wire.endTransmission();
Wire.beginTransmission(currentDeviceId);
Wire.write(0x00);
Wire.write(newDeviceId);
Wire.endTransmission();
}
I looked trought previous posts about but I didn t found a solution working.
Someone can help me ?
Thanks in advance