(I couldn't find the referenced posts, but I used them )
This program returns - No I2C devices found.
running on nano 33 BLE -not the sense version
running on a nano 328, returns 0x77 -a TSY01 temp sensor
The program further below returns(was returning)
(I cannot get this to find anything now.)
I2C device found at address 0x1E !
I2C device found at address 0x6B !
--> presumably these are the internal i2c devices
and it doesn't see the i2c device plugged into
A4 and A5, common ground, 3.3v
and again it works fine on the nano 328p
So, anyway, I've moved on. I wanted a sensor
to display something while I worked on the peripheral
program. I have switched to a TMP36, using A0,
using the Battery Monitor peripheral example.
And that's fine.
Thanks Klaus
I'll get back to i2c, and btw I couldn't get the dht11
to work either, on the nano 33 ble,
Thanks, good day, I've moved on.
// --------------------------------------
// i2c_scanner
// from::Arduino Playground - I2cScanner
// comments removed
// ---------------------------------------
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}
=======================================
I can no longer get this to scan the nano 33 ble internal i2c
#include "Wire.h"
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial);
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}