Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions examples/01.Basics/Blink/Blink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
*/

void setup() {
pinMode(BUILTIN_LED, OUTPUT); // initialize onboard LED as output
pinMode(LED_BUILTIN, OUTPUT); // Initialize onboard LED as output
}

void loop() {
digitalWrite(BUILTIN_LED, HIGH); // turn on LED with voltage HIGH
delay(1000); // wait one second
digitalWrite(BUILTIN_LED, LOW); // turn off LED with voltage LOW
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(1000); // Wait one second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(1000); // wait one second
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
//Install [claws/BH1750 Library](https://github.com/claws/BH1750) first.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <BH1750.h>

#define SCREEN_WIDTH 64 // OLED display width, in pixels
#define SCREEN_HEIGHT 48 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// SCL GPIO5
// SDA GPIO4
#define OLED_RESET 0 // GPIO0
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

/*

BH1750 can be physically configured to use two I2C addresses:
- 0x23 (most common) (if ADD pin had < 0.7VCC voltage)
- 0x5C (if ADD pin had > 0.7VCC voltage)

Library uses 0x23 address as default, but you can define any other address.
If you had troubles with default value - try to change it to 0x5C.

*/
BH1750 light(0x23);

void setup() {

Serial.begin(115200);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)); // Address 0x3C for 64x48

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
//Install [LOLIN_HP303B_Library](https://github.com/wemos/LOLIN_HP303B_Library.git) first.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <LOLIN_HP303B.h>

LOLIN_HP303B HP303B;

#define SCREEN_WIDTH 64 // OLED display width, in pixels
#define SCREEN_HEIGHT 48 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// SCL GPIO5
// SDA GPIO4
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup()
{

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)); // Address 0x3C for 64x48
display.setTextColor(WHITE);

//Address of the HP303B (0x77 or 0x76)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//Install [LOLIN_HP303B_Library](https://github.com/wemos/LOLIN_HP303B_Library.git) first.

#include <LOLIN_HP303B.h>

LOLIN_HP303B HP303B;
Expand Down
Loading