I have an elegoo uno r3 and i want to connect two no name bmp180 sensors wich do not have an Adress selector pin to it without using a multiplexer. I'm new to Arduino so i dont know how to use the library softwire or even wire can someone help me write the code for the second sensor wich will be connected to digital pins 6 and 7.
#include <Adafruit_BMP085.h>
#include <Wire.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);//RS,EN,D4,D5,D6,D7
char PRESSURESHOW[4];// initializing a character of size 4 for showing the result
char TEMPARATURESHOW[4];// initializing a character of size 4 for showing the temparature result
Adafruit_BMP085 bmp;
void setup() {
lcd.begin(16, 2);
// Print a logo message to the LCD.
lcd.print(" BMP180 Sensor");
lcd.setCursor(0, 1);
lcd.print("Temp. & Pressure");
lcd.setCursor(0, 2);
delay (3000);
lcd.clear();//clear display
Serial.begin(9600);
if (!bmp.begin())
{
Serial.println("ERROR");///if there is an error in communication
while (1) {}
}
}
void loop()
{
Serial.print("Temperature:");
Serial.print(bmp.readTemperature());
Serial.print(",");
Serial.print("Pressure:");
Serial.print(bmp.readPressure());
Serial.print(",");
lcd.print("Pressure= "); // print name
String PRESSUREVALUE = String(bmp.readPressure());
// convert the reading to a char array
PRESSUREVALUE.toCharArray(PRESSURESHOW, 4);
lcd.print(PRESSURESHOW);
lcd.print("hPa ");
lcd.setCursor(0, 1);
lcd.print("Temparature=");// print name
String TEMPARATUREVALUE = String(bmp.readTemperature());
// convert the reading to a char array
TEMPARATUREVALUE.toCharArray(TEMPARATURESHOW, 4);
lcd.print(TEMPARATURESHOW);
lcd.print("C ");
lcd.setCursor(0, 0);//set the cursor to column 0, line1
delay(500);
}
I don't either. But if I had to figure it out I would look at the example code that comes with the libraries and read whatever documentation that I could find. Then run the examples with my sensors to see if I could make them work.
If I could not get them to work, then maybe post the code that I tried, a schematic of the circuit and the details of the results of my attempts.
There may be members that have used the libraries that can help.
i now tried solving the problem with bit bang wich seems to be easier to use than softwire and connected the first bmp scl to digital pin 4 and sda to digital pin 4 for the second bmp scl to digital pin 7 and sda to digital pin 6