Skip to content

Commit fdca3a4

Browse files
author
Vino Rodrigues
committedJul 11, 2021
re-upload of v2.3
1 parent b3c315f commit fdca3a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+16240
-7779
lines changed
 

‎Arduino/01_Blink/01_Blink.ino

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
ESP8266 Blink by Simon Peter
3+
Blink the blue LED on the ESP-01 module
4+
This example code is in the public domain
5+
6+
The blue LED on the ESP-01 module is connected to GPIO1
7+
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
8+
9+
Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
10+
*/
11+
12+
void setup() {
13+
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
14+
15+
Serial.begin(115200);
16+
while (!Serial); // Leonardo: wait for serial monitor
17+
Serial.print("Starting... ");
18+
Serial.print(LED_BUILTIN);
19+
Serial.print("... ");
20+
21+
Serial.println();
22+
}
23+
24+
// the loop function runs over and over again forever
25+
void loop() {
26+
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
27+
// but actually the LED is on; this is because
28+
// it is active low on the ESP-01)
29+
delay(333); // Wait for a second
30+
digitalWrite(LED_BUILTIN, HIGH);
31+
delay(333);
32+
digitalWrite(LED_BUILTIN, LOW);
33+
delay(333);
34+
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
35+
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
36+
}

‎Arduino/02_Scan_I2C/02_scan_i2c.ino

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// --------------------------------------
2+
// Modified from: http://playground.arduino.cc/Main/I2cScanner
3+
// i2c_scanner
4+
5+
#include <Wire.h>
6+
7+
#define SDA_PIN 0
8+
#define SCL_PIN 2
9+
10+
void setup() {
11+
Wire.begin(SDA_PIN, SCL_PIN);
12+
13+
Serial.begin(57600);
14+
while (!Serial); // Leonardo: wait for serial monitor
15+
Serial.println("I2C Scanner (ESP-01)");
16+
}
17+
18+
19+
void loop() {
20+
byte error, address;
21+
int nDevices;
22+
23+
Serial.println(); Serial.println();
24+
Serial.println("Scanning...");
25+
26+
nDevices = 0;
27+
for(address = 1; address <= 127; address++ ) {
28+
29+
// delay(1);
30+
31+
// The i2c_scanner uses the return value of
32+
// the Write.endTransmisstion to see if
33+
// a device did acknowledge to the address.
34+
Wire.beginTransmission(address);
35+
error = Wire.endTransmission();
36+
37+
if (error == 0) {
38+
39+
nDevices++;
40+
41+
Serial.print("[");
42+
Serial.print(nDevices);
43+
Serial.print("] Address = ");
44+
Serial.print(address, DEC);
45+
Serial.print(" (0x");
46+
if (address < 16) Serial.print("0");
47+
Serial.print(address, HEX);
48+
Serial.println(")");
49+
50+
51+
} else if (error == 4) {
52+
53+
Serial.print("Error @ (0x");
54+
if (address<16) Serial.print("0");
55+
Serial.print(address, HEX);
56+
Serial.println(")");
57+
58+
}
59+
}
60+
61+
if (nDevices == 0)
62+
Serial.println("No I2C devices found.");
63+
else {
64+
Serial.print("Found ");
65+
Serial.print(nDevices);
66+
Serial.print(" I2C device");
67+
if (nDevices > 1) Serial.print("s");
68+
Serial.println(".");
69+
}
70+
71+
delay(10000); // wait 5 seconds for next scan
72+
}

0 commit comments

Comments
 (0)
Please sign in to comment.