background image

1

2

3

4

5

6

7

8

9

1
0

1
1

1
2

1
3

1
4

1
5

1
6

/*
* Blink
* Turns on the onboard LED on for one second, then off for one second, 
repeatedly.
* This uses delay() to pause between LED toggles.
*/

 

void

 

setup

()

 

{

  

pinMode

(

BUILTIN_LED

,

 

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

  

delay

(

1000

);

                      

// wait one second

}

Pressing the Upload button will build and upload to code to the board and once this is complete, the 

build-in Blue LED (D4 / GPIO2) will blink every second. So my board is working.

As you can see I’ve already connected DHT Pro shield to the board, so let’s try the sample for the shield 

to get the temperature and humidity in File->Sketchbooks->D1_mini_Examples->04. Shield-
>DHT_Pro_Shield->Simple:

Summary of Contents for D1 Mini V3

Page 1: ...o give it a try and bought the board together with two temperature shields a relay shield and micro SD shield Click to Enlarge I got all for 14 00 from Wemos Aliexpress shop and it took about one month for delivery I can also see they ve recently released a new OLED shield selling for about 5 All shields were shipped inside their own anti static bags The pins are clearly marked on both side of the...

Page 2: ...and the other side has CH340 serial to USB chip and the reset button ...

Page 3: ... if you wish too For example I connect Wemos D1 mini to both the relay shield and DHT Pro shield after soldering some of the headers The only potential pitfall would be to solder the header on the wrong side so you just need to make sure the pins 5V RST are properly aligned ...

Page 4: ...ly used the recommended way git The first step was to install and run Arduino 1 6 8 Since I m using a computer running Ubuntu 14 04 64 bit I downloaded and installed Arduino 1 6 8 64 bit for Linux 1 2 3 tar xvf arduino 1 6 8 linux64 tar xz cd arduino 1 6 8 arduino Now get the sketchbook folder by going to File Preferences Note this folder as this is where we ll install the board support tools and ...

Page 5: ...it clone Now connect Wemos D1 mini to a USB port of your computer with a micro USB to USB cable In Linux you should see a new device in the kernel log 1 2 3 4 5 6 8643 196931 usb 7 3 new full speed USB device number 4 using ohci pci 8643 361709 usb 7 3 New USB device found idVendor 1a86 idProduct 7523 8643 361717 usb 7 3 New USB device strings Mfr 0 Product 2 SerialNumber 0 8643 361722 usb 7 3 Pro...

Page 6: ...settings include 80 MHz CPU frequency 4M flash size 912600 upload speed and dev ttyUSB0 port We can now use the code samples and to make sure everything works I ll run the blink project in File Sketchbooks D1_mini_Examples 01 Basics Blink ...

Page 7: ...ltage HIGH delay 1000 wait one second digitalWrite BUILTIN_LED LOW turn off LED with voltage LOW delay 1000 wait one second Pressing the Upload button will build and upload to code to the board and once this is complete the build in Blue LED D4 GPIO2 will blink every second So my board is working As you can see I ve already connected DHT Pro shield to the board so let s try the sample for the shie...

Page 8: ...ct pin 1 on the left of the sensor to 5V NOTE If using a board with 3 3V logic like an Arduino Due connect pin 1 to 3 3V instead of 5V Connect pin 2 of the sensor to whatever your DHTPIN is Connect pin 4 on the right of the sensor to GROUND Connect a 10K resistor from pin 2 data to pin 1 power of the sensor Initialize DHT sensor Note that older versions of this library took an optional third param...

Page 9: ...readTemperature Read temperature as Fahrenheit isFahrenheit true float f dht readTemperature true Check if any reads failed and exit early to try again if isnan h isnan t isnan f Serial println Failed to read from DHT sensor return Compute heat index in Fahrenheit the default float hif dht computeHeatIndex f h Compute heat index in Celsius isFahreheit false float hic dht computeHeatIndex t h false...

Page 10: ...clude DHT h compilation terminated exit status 1 Error compiling for board WeMos D1 R2 amp mini To fix that error go to Sketch Include Library Manage Libraries input dht to filter the library and install DHT sensor library by Adafruit Now click on the Upload button again the code will be compiled and uploaded to the board Now open the serial monitor with Ctrl Shift M or Tools Serial Monitor and yo...

Page 11: ...thermometer 32 5 C Pretty good If you d like to get results displayed on a web page instead you may want to modify DHT Shield SimpleServer sample Now I ll had the relay shield on top and run another sample File Sketchbooks D1_mini_Examples 04 Shield Relay_Shield Blink C ...

Page 12: ... pinMode relayPin OUTPUT void loop digitalWrite relayPin HIGH turn on relay with voltage HIGH delay interval pause digitalWrite relayPin LOW turn off relay with voltage LOW delay interval pause The relay blink sample will turn on and off the relay every two seconds Since the DHT Pro shield uses D4 pin and the Relay shield uses D1 pin both can be used at the same time I had no problem uploading the...

Reviews: