ESP8266 Boards: Wemos D1 mini Pro (https://wiki.wemos.cc/products:d1:d1_mini_pro)
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Arduino IDE works well with these boards: https://www.arduino.cc/en/main/software
Add the ESP8266 Boards to the Arduino Board Library: http://www.instructables.com/id/Programming-the-WeMos-Using-Arduino-SoftwareIDE/
https://github.com/wemos/WEMOS_Matrix_LED_Shield_Arduino_Library
#include <WEMOS_Matrix_LED.h>
MLED mled(5); //set intensity=5
void setup()
{
}
void loop() {
for(int y=0;y<8;y++)
{
for(int x=0;x<8;x++)
{
mled.dot(x,y); // draw dot
mled.display();
delay(200);
}
}
}
/*
* 1 Button Shield - Simple Push
* Press the pushbutton to switch on the LED
*
* 1 Button Shield pushbutton connects pin D3 to GND
*/
const int buttonPin = D3;
const int ledPin = BUILTIN_LED;
int buttonState = 0;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
// set initial state, LED off
digitalWrite(ledPin, buttonState);
}
void loop() {
// read button state, HIGH when pressed, LOW when not
buttonState = digitalRead(buttonPin);
// if the push button pressed, switch on the LED
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH); // LED on
} else {
digitalWrite(ledPin, LOW); // LED off
}
}
int buzzer=D5; //Buzzer control port, default D5
int freq[] = { 1047, 1175, 1319, 1397, 1568, 1760, 1976, 2093 };//Note name: C6 D6 E6 F6 G6 A6 B6 C7 http://newt.phys.unsw.edu.au/jw/notes.html
String note[] = {"C6", "D6", "E6", "F6", "G6", "A6", "B6", "C7"};
void setup() {
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
Serial.begin(115200);
Serial.println("Buzzer Test...");
}
void loop() {
for(int i=0; i<8; i++){
analogWriteRange(freq[i]);
Serial.print("Note name: ");
Serial.print(note[i]);
Serial.print(", Freq: ");
Serial.print(freq[i]);
Serial.println("Hz");
analogWrite(buzzer, 512);
delay(1000);
analogWrite(buzzer, 0);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
delay(1000);
}
Serial.println("STOP");
delay(5000);
}
Required library: https://github.com/wemos/WEMOS_SHT3x_Arduino_Library
#include <WEMOS_SHT3X.h>
SHT3X sht30(0x45);
void setup() {
Serial.begin(115200);
}
void loop() {
if(sht30.get()==0){
Serial.print("Temperature in Celsius : ");
Serial.println(sht30.cTemp);
Serial.print("Temperature in Fahrenheit : ");
Serial.println(sht30.fTemp);
Serial.print("Relative Humidity : ");
Serial.println(sht30.humidity);
Serial.println();
}
else
{
Serial.println("Error!");
}
delay(1000);
}
Use this library: https://github.com/Shigawire/Adafruit_SSD1306
Important OLED_RESET is on GPIO0: https://wiki.wemos.cc/_media/products:d1_mini_shields:mini_oled.pdf
#define OLED_RESET 0
Sample Script:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
//when in doubt, change the Adafruit_SSD1306.h file for this definition
#define SSD1306_128_64
// default pins: SCL=D1=GPIO5, SDA=D2=GPIO4
#define OLED_RESET 0 // OLED_RESET=D3=GPIO0
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // I2C addr 0x3C
display.setTextColor(WHITE);
display.clearDisplay(); // Clear the display-buffer
//-----write text to buffer------------------------------------
display.setTextSize(1);
display.setCursor(0,0);
display.println("1234567890");
display.println("abcdefghij");
display.println("ABCDEFGHIJ");
display.println("--Line 4--");
display.println("1234567890");
display.println("-_Line 6_-");
display.display(); // show buffer
}
void loop() {
}