First commit

This commit is contained in:
2020-08-01 13:47:02 +03:00
commit ac18805ff4
142 changed files with 8325 additions and 0 deletions

54
I2C Scan/src/main.cpp Normal file
View File

@@ -0,0 +1,54 @@
#include <Arduino.h>
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
/*#undef PIN_WIRE_SDA
#undef PIN_WIRE_SCL
#define PIN_WIRE_SCL D1
#define PIN_WIRE_SDA D2*/
#include <Wire.h>
void setup() {
Serial.begin (9600);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
Serial.println ();
//#undef SCL
//#undef SDA
Serial.print("SCL=");Serial.println (SCL);
Serial.print("SDA=");Serial.println (SDA);
Serial.print("PWSCL=");Serial.println (PIN_WIRE_SCL);
Serial.print("PWSDA=");Serial.println (PIN_WIRE_SDA);
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
/*#define SCL 5
#define SDA 4*/
Wire.begin();
for (byte i = 8; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}