Initial commit

This commit is contained in:
tom
2025-01-28 21:44:32 +01:00
commit a410b03909
15 changed files with 687 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
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.println(address, HEX);
nDevices++;
}
else if (error == 4)
{
Serial.print("Unknow 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);
}

View File

@@ -0,0 +1,35 @@
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
/*
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp32-spi-communication-arduino/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*/
// Find the default SPI pins for your board
// Make sure you have the right board selected in Tools > Boards
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("MOSI: ");
Serial.println(MOSI);
Serial.print("MISO: ");
Serial.println(MISO);
Serial.print("SCK: ");
Serial.println(SCK);
Serial.print("SS: ");
Serial.println(SS);
}
void loop()
{
// put your main code here, to run repeatedly:
}