Nucleo_SSD1306_DS1302_ESP8266_AM2320_BME280

Dependencies:   AM2320 AutomationElements BME280 DS1302 ESP8266 mbed

Files at this revision

API Documentation at this revision

Comitter:
dadangjia
Date:
Thu May 11 16:57:18 2017 +0000
Commit message:
OK

Changed in this revision

AM2320.lib Show annotated file Show diff for this revision Revisions of this file
AutomationElements.lib Show annotated file Show diff for this revision Revisions of this file
BME280.lib Show annotated file Show diff for this revision Revisions of this file
DS1302.lib Show annotated file Show diff for this revision Revisions of this file
ESP8266.lib Show annotated file Show diff for this revision Revisions of this file
HC-SR04/HCSR04.cpp Show annotated file Show diff for this revision Revisions of this file
HC-SR04/HCSR04.h Show annotated file Show diff for this revision Revisions of this file
OLED/CriusOLED.h Show annotated file Show diff for this revision Revisions of this file
OLED/data.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AM2320.lib	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/yasuyuki/code/AM2320/#766868b34d56
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AutomationElements.lib	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/TVZ-Mechatronics-Team/code/AutomationElements/#b9e11da0f2eb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BME280.lib	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/MACRUM/code/BME280/#ddcaa259e65b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS1302.lib	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Sissors/code/DS1302/#9a746f303e59
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266.lib	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/dadangjia/code/ESP8266/#a1da4dcd891a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC-SR04/HCSR04.cpp	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,81 @@
+#include "mbed.h"
+#include "HCSR04.h"
+
+HCSR04::HCSR04(PinName echoPin, PinName triggerPin) : echo(echoPin), trigger(triggerPin) {
+    init();
+}
+
+void HCSR04::init() {
+    distance = -1;      // initial distance
+    minDistance = 2;
+    maxDistance = 400;
+    newDataReady = timerStarted = false;
+}
+
+void HCSR04::startTimer() {
+    if (!timerStarted) {
+        timer.start(); // start the timer
+        timerStarted = true;
+        echoTimeout.attach_us(this, &HCSR04::stopTimer, 25000); // in case echo fall does not occur
+        echo.fall(this, &HCSR04::stopTimer);
+        echo.rise(NULL);
+    }
+}
+
+void HCSR04::stopTimer() {
+    timer.stop(); // stop the timer
+    if (timerStarted) {
+        distance = timer.read() * 1e6 / 58;
+        if (distance < minDistance)
+            distance = minDistance;
+        if (distance > maxDistance)
+            distance = maxDistance;
+        newDataReady = true;
+    }
+    timer.reset();
+    timerStarted = false;
+    echoTimeout.detach();
+    echo.fall(NULL);
+}
+
+void HCSR04::turnOffTrigger() {
+    trigger = 0; 
+}
+
+void HCSR04::startMeasurement() {
+    trigger = 1;
+    triggerTimeout.attach_us(this, &HCSR04::turnOffTrigger, 10);
+    echo.rise(this, &HCSR04::startTimer);
+    newDataReady = false;
+}
+
+float HCSR04::getDistance_cm() {
+    newDataReady = false;
+    return distance;
+}
+
+float HCSR04::getDistance_mm() {
+    newDataReady = false;
+    return distance * 10;
+}
+
+bool HCSR04::isNewDataReady() {
+    return newDataReady;
+}
+
+void HCSR04::setRanges(float minRange, float maxRange) {
+    if (minRange < maxRange) {
+        if (minRange >= 2 && minRange < 400) // bug from revs. 4 and 5 corrected
+            minDistance = minRange;
+        if (maxRange <= 400)
+            maxDistance = maxRange;
+    }
+}
+
+float HCSR04::getMinRange() {
+    return minDistance;
+}
+
+float HCSR04::getMaxRange() {
+    return maxDistance;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC-SR04/HCSR04.h	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,103 @@
+#ifndef HCSR04_H_TVZMT
+#define HCSR04_H_TVZMT
+
+/** A distance measurement class using ultrasonic sensor HC-SR04.
+ *  
+ * Example of use:
+ * @code
+ * #include "mbed.h"
+ * #include "HCSR04.h"
+ *
+ * Serial pc(USBTX, USBRX);
+ * Timer timer;
+ *
+ * int main() {
+ *     HCSR04 sensor(p5, p7);
+ *     sensor.setRanges(10, 110);
+ *     pc.printf("Min. range = %g cm\n\rMax. range = %g cm\n\r",
+ *       sensor.getMinRange(), sensor.getMaxRange());
+ *     while(true) {
+ *         timer.reset();
+ *         timer.start();
+ *         sensor.startMeasurement();
+ *         while(!sensor.isNewDataReady()) {
+ *             // wait for new data
+ *             // waiting time depends on the distance
+ *         }
+ *         pc.printf("Distance: %5.1f mm\r", sensor.getDistance_mm());
+ *         timer.stop();
+ *         wait_ms(500 - timer.read_ms()); // time the loop
+ *     }
+ * }
+ * @endcode
+ */
+class HCSR04 {
+    
+    public:
+    
+    /** Receives two PinName variables.
+     * @param echoPin mbed pin to which the echo signal is connected to
+     * @param triggerPin mbed pin to which the trigger signal is connected to
+     */
+    HCSR04(PinName echoPin, PinName triggerPin);
+    
+    /** Start the measurement. Measurement time depends on the distance.
+     *  Maximum measurement time is limited to 25 ms (400 cm).
+     */
+    void startMeasurement();
+    
+    /** Returns the distance in cm. Requires previous call of startMeasurement().
+     * @returns distance of the measuring object in cm.
+     */
+    float getDistance_cm();
+    
+    /** Returns the distance in mm. Requires previous call of startMeasurement().
+     * @returns distance of the measuring object in mm.
+     */
+    float getDistance_mm();
+    
+    /** Sets the minimum and maximum ranges between the factory values of 2 cm and 400 cm.
+     *  @param minRange Minimum range in cm. Must be between 2 cm and maxRange.
+     *  @param maxRange Maximum range in cm. Must be between minRange and 400 cm.
+     */
+    void setRanges(float minRange, float maxRange);
+    
+    /** Retreives the minimum sensor range set by the user.
+     * @returns the minimum sensor range set by the user in cm.
+     */
+    float getMinRange();
+    
+    /** Retreives the maximum sensor range set by the user.
+     * @returns the maximum sensor range set by the user in cm.
+     */
+    float getMaxRange();
+    
+    /** Checks if the new data is ready.
+     * @returns true if new data is ready, false otherwise.
+     */
+    bool isNewDataReady();
+    
+    private:
+    
+    InterruptIn echo;       // echo pin
+    DigitalOut trigger;     // trigger pin
+    Timer timer;            // echo pulsewidth measurement
+    float distance;         // store the distance in cm
+    float minDistance;      // minimum measurable distance
+    float maxDistance;      // maximum measurable distance
+    Timeout triggerTimeout, echoTimeout;
+    bool newDataReady, timerStarted;
+    
+    /** Start the timer. */
+    void startTimer();
+    
+    /** Stop the timer. */
+    void stopTimer();
+    
+    /** Initialization. */
+    void init();
+    
+    void turnOffTrigger();
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OLED/CriusOLED.h	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,272 @@
+/* ============================================
+Modified Code from Crius
+The CriusOLED Hardware MUST be modified for correct function of ACK
+Copyright (c) 2014 Michael Ruck michael@ruck.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+===============================================
+*/
+#include "./data.h"
+#define OLED_ADDR    (0x78)
+
+I2C i2c(I2C_SDA, I2C_SCL);
+
+void displayOn(void);
+void displayOff(void);
+void SendByte(unsigned char data);
+void sendcommand(unsigned char com);
+void SendByte(unsigned char com);
+void printBigNumber(unsigned char s, int X, int Y);
+void SendByteXY(unsigned char data, int X, int Y);
+
+
+//==========================================================//
+// Turns display on.
+void displayOn(void)
+{
+    sendcommand(0xaf);        //display on
+}
+
+//==========================================================//
+// Turns display off.
+void displayOff(void)
+{
+    sendcommand(0xae);        //display off
+}
+//==========================================================//
+// Actually this sends a byte, not a char to draw in the display.
+// Display's chars uses 8 byte font the small ones and 96 bytes
+// for the big number font.
+void SendByte(unsigned char data)
+{
+    //Create a temporary buffer
+    char buff[2];
+
+    //Load the control byte and 8-bit data
+    buff[0] = (0x40);
+    buff[1] = data;
+
+    //Write the data
+    i2c.write(OLED_ADDR, buff, 2);
+
+}
+
+//==========================================================//
+// Used to send commands to the display.
+void sendcommand(unsigned char com)
+{
+    //Create a temporary buffer
+    char buff[2];
+
+    //Load the control byte and 8-bit command
+    buff[0] = 0x00;
+    buff[1] = com;
+
+    //Write the command
+    i2c.write(OLED_ADDR, buff, 2);
+}
+//==========================================================//
+// Set the cursor position in a 16 COL * 8 ROW map.
+void setXY(unsigned char row,unsigned char col)
+{
+    sendcommand(0xb0+row);                //set page address
+    sendcommand(0x00+(8*col&0x0f));       //set low col address
+    sendcommand(0x10+((8*col>>4)&0x0f));  //set high col address
+}
+//==========================================================//
+// Clears the display by sendind 0 to all the screen map.
+void clear_display(void)
+{
+    unsigned char i,k;
+    for(k=0; k<8; k++) {
+        setXY(k,0);
+        {
+            for(i=0; i<128; i++) { //clear all COL
+                SendByte(0);         //clear all COL
+                //delay(10);
+            }
+        }
+    }
+}
+//==========================================================//
+// Resets display depending on the actual mode.
+void reset_display(void)
+{
+    displayOff();
+    clear_display();
+
+
+    displayOn();
+}
+//==========================================================//
+
+void sendImage()
+{
+    reset_display();
+    for(int i=0; i<128*8; i++)   // show 128* 64 Logo
+        SendByte(logo[i]);
+
+}
+//==========================================================//
+void printBigTime(char *s)
+{
+
+    int Y=0;
+    int lon = strlen(s);
+    if(lon == 3) {
+        Y = 0;
+    } else if (lon == 2) {
+        Y = 3;
+    } else if (lon == 1) {
+        Y = 6;
+    }
+
+    int X = 2;
+    while(*s) {
+        printBigNumber(*s, X, Y);
+
+        Y+=3;
+        X=2;
+        setXY(X,Y);
+        *s++;
+    }
+}
+
+
+//==========================================================//
+// Prints a display big number (96 bytes) in coordinates X Y,
+// being multiples of 8. This means we have 16 COLS (0-15)
+// and 8 ROWS (0-7).
+void printBigNumber(unsigned char s, int X, int Y)
+{
+    setXY(X,Y);
+    int salto=0;
+    for(int i=0; i<96; i++) {
+        if(s == ' ') {
+            SendByte(0);
+        } else
+            SendByte(bigNumbers[s-0x30][i]);
+
+        if(salto == 23) {
+            salto = 0;
+            X++;
+            setXY(X,Y);
+        } else {
+            salto++;
+        }
+    }
+}
+//==========================================================//
+// Prints a display char (not just a byte) in coordinates X Y,
+// being multiples of 8. This means we have 16 COLS (0-15)
+// and 8 ROWS (0-7).
+void SendByteXY(unsigned char data, int X, int Y)
+{
+    i2c.start();
+    i2c.write(OLED_ADDR);
+    i2c.write(0x40);
+
+    for(int i=0; i<8; i++)
+        i2c.write((int)(myFont[data-0x20]+i)); // <<-------------------------------------
+
+    i2c.stop();     // stop transmitting
+}
+//==========================================================//
+// Prints a string regardless the cursor position.
+void sendStr(unsigned char *s)
+{
+    unsigned char i=0;
+    while(*s) {
+        for(i=0; i<8; i++) {
+            SendByte(myFont[*s-0x20][i]);
+        }
+        *s++;
+    }
+}
+//==========================================================//
+// Prints a string in coordinates X Y, being multiples of 8.
+// This means we have 16 COLS (0-15) and 8 ROWS (0-7).
+void sendStrXY( char *s, int X, int Y)
+{
+    setXY(X,Y);
+    unsigned char i=0;
+    while(*s) {
+        for(i=0; i<8; i++) {
+            SendByte(myFont[*s-0x20][i]);
+        }
+        *s++;
+    }
+}
+
+
+//==========================================================//
+// Inits oled and draws logo at startup
+void init_OLED(void)
+{
+    sendcommand(0xae);        //display off
+    sendcommand(0xa6);            //Set Normal Display (default)
+    // Adafruit Init sequence for 128x64 OLED module
+    sendcommand(0xAE);             //DISPLAYOFF
+    sendcommand(0xD5);            //SETDISPLAYCLOCKDIV
+    sendcommand(0x80);            // the suggested ratio 0x80
+    sendcommand(0xA8);            //SSD1306_SETMULTIPLEX
+    sendcommand(0x3F);
+    sendcommand(0xD3);            //SETDISPLAYOFFSET
+    sendcommand(0x0);             //no offset
+    sendcommand(0x40 | 0x0);      //SETSTARTLINE
+    sendcommand(0x8D);            //CHARGEPUMP
+    sendcommand(0x14);
+    sendcommand(0x20);             //MEMORYMODE
+    sendcommand(0x00);             //0x0 act like ks0108
+
+    sendcommand(0xA0 | 0x1);      //SEGREMAP   //Rotate screen 180 deg
+    //sendcommand(0xA0);
+
+    sendcommand(0xC8);            //COMSCANDEC  Rotate screen 180 Deg
+    //sendcommand(0xC0);
+
+    sendcommand(0xDA);            //0xDA
+    sendcommand(0x12);           //COMSCANDEC
+    sendcommand(0x81);           //SETCONTRAS
+    sendcommand(0xCF);           //
+    sendcommand(0xd9);          //SETPRECHARGE
+    sendcommand(0xF1);
+    sendcommand(0xDB);        //SETVCOMDETECT
+    sendcommand(0x40);
+    sendcommand(0xA4);        //DISPLAYALLON_RESUME
+    sendcommand(0xA6);        //NORMALDISPLAY
+
+    clear_display();
+    sendcommand(0x2e);            // stop scroll
+    //----------------------------REVERSE comments----------------------------//
+    //  sendcommand(0xa0);        //seg re-map 0->127(default)
+    //  sendcommand(0xa1);        //seg re-map 127->0
+    //  sendcommand(0xc8);
+    //  delay(1000);
+    //----------------------------REVERSE comments----------------------------//
+    // sendcommand(0xa7);  //Set Inverse Display
+    // sendcommand(0xae);     //display off
+    sendcommand(0x20);            //Set Memory Addressing Mode
+    sendcommand(0x00);            //Set Memory Addressing Mode ab Horizontal addressing mode
+    //  sendcommand(0x02);         // Set Memory Addressing Mode ab Page addressing mode(RESET)
+
+    setXY(0,0);
+
+    sendcommand(0xaf);        //display on
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OLED/data.h	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,283 @@
+/* 
+ * This file contains all the static arrays to draw things in the display.
+ */
+
+
+// GPS Logo
+char logo []  = { 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
+0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xF8, 0x3C, 0x1C, 0x0E, 0x07,
+0x07, 0x83, 0x83, 0x83, 0xC3, 0xC7, 0xEF, 0xFE, 0x7C, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x00,
+0x00, 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0x78, 0x1C, 0x1E, 0x0E, 0x07, 0x07, 0x1F, 0xFB, 0xAB, 0x83,
+0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x07, 0x0F, 0x3F, 0xFF, 0xFC, 0x8E, 0x0E, 0x06, 0x07,
+0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x7E, 0xFF, 0xE7, 0xE1, 0xE1, 0xE0, 0xE0, 0x60, 0x60, 0x70, 0x71, 0x71, 0x71, 0x33, 0x37,
+0x3F, 0x7E, 0xFF, 0xEF, 0x83, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, 0x03, 0x0E,
+0x70, 0xC0, 0x00, 0x78, 0xFC, 0xCE, 0xC6, 0xC6, 0xFE, 0xFC, 0x31, 0x07, 0x3F, 0xFE, 0xF0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x0F, 0x7F, 0xFC, 0xE3, 0x8F, 0x1F, 0x18, 0x18, 0x1C, 0x0F, 0x0F, 0x00, 0x80,
+0x80, 0x41, 0x6E, 0x38, 0x20, 0x11, 0x11, 0x11, 0x70, 0x10, 0x70, 0x10, 0xF0, 0xFF, 0xFF, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0xF0, 0xF0, 0x10, 0x10, 0x00, 0x00, 0xD8, 0xD8, 0x00,
+0x00, 0xC0, 0xC0, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0, 0x40, 0x40, 0xF8, 0xF8, 0x00,
+0x00, 0xD8, 0xD8, 0x00, 0x00, 0x80, 0xC0, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x80, 0xC0, 0x40, 0x40, 0x80, 0x00, 0x80, 0xC0, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0xC0,
+0xC0, 0x40, 0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xFE, 0xE7, 0xC7, 0xE7, 0x7E, 0x7C, 0x00, 0x00,
+0x00, 0x00, 0x80, 0xE0, 0xF8, 0x7D, 0x1F, 0x87, 0xCF, 0xFE, 0xFC, 0xFC, 0xF4, 0xE2, 0xC1, 0x81,
+0x00, 0x10, 0x18, 0x18, 0x1C, 0x1C, 0x9E, 0x8E, 0xC7, 0xC0, 0xE0, 0xF0, 0x7F, 0x3F, 0x1F, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00,
+0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x1F, 0x1F, 0x00,
+0x00, 0x1F, 0x1F, 0x00, 0x00, 0x0F, 0x1F, 0x12, 0x12, 0x13, 0x0B, 0x00, 0x00, 0x18, 0x18, 0x00,
+0x00, 0x0F, 0x1F, 0x10, 0x10, 0x08, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x1F,
+0x1F, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x06, 0x0E, 0x0E, 0xFE, 0xFF, 0x0F, 0x7F, 0xFF, 0xF7, 0x87, 0x06, 0x00,
+0xE0, 0xFE, 0xFF, 0x0F, 0x01, 0x00, 0x0F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0x3F, 0x1E, 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, 0x01, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE7, 0x7F, 0x7E, 0x78, 0x31, 0x33, 0x3F, 0x3E, 0x7E,
+0xFF, 0xEF, 0xC0, 0xE0, 0x60, 0x60, 0x70, 0x60, 0x60, 0xE0, 0xE0, 0xC0, 0x90, 0xE5, 0xFF, 0xC3,
+0xE0, 0xE0, 0x60, 0x60, 0x70, 0x60, 0x60, 0xE0, 0xC0, 0xFF, 0xFF, 0x3F, 0x30, 0x30, 0x70, 0x70,
+0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x7E, 0x7F, 0x67, 0x61, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78,
+0x7F, 0x7F, 0x61, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x61, 0x7F, 0x7F, 0x7F, 0x61,
+0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x61, 0x7F, 0x7F, 0x78, 0x60, 0x60, 0x60, 0x60,
+0x60, 0x61, 0x67, 0x7F, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+// Big numbers font, from 0 to 9. 96 byte each.
+char bigNumbers [][96] = {
+{0x00, 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0,
+0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
+0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xC1, 0xC0, 0xC0, 0xC0,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+0x03, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xC1, 0xC0, 0xC0, 0xC0,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x81, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x87,
+0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
+0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 0x81, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x81, 0x83, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x87,
+0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC1, 0x81, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x87,
+0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xE1,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x87, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x87,
+0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x0F, 0x0F, 0x0F,
+0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
+0xF0, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1,
+0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07,
+0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0F, 0x0F, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00},
+
+{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x7E, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+};
+
+// Big numbers minus simbol.
+char minus [] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x0C, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
+0x1E, 0x1E, 0x1E, 0x1E, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+// Km/h in big font. This avoids to create an entirely new big font and saves flash space.
+char kmh []  = {
+0x00, 0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x80,
+0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xF0, 0xF8, 0xFC,
+0x9E, 0x0E, 0x06, 0xE0, 0xF0, 0xF0, 0xF0, 0x70, 0xF0, 0xE0, 0xF0, 0xF0, 0x70, 0xF0, 0xE0, 0xC0,
+0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x18, 0x18, 0xF8, 0xF0, 0xF0, 0x00,
+0x00, 0x00, 0x07, 0x07, 0x07, 0x00, 0x01, 0x03, 0x07, 0x07, 0x06, 0x07, 0x07, 0x07, 0x00, 0x00,
+0x07, 0x07, 0x07, 0x00, 0x00, 0x07, 0x07, 0x07, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x07,
+0x07, 0x07, 0x00, 0x00, 0x07, 0x07, 0x07, 0x00
+};
+
+// degrees, outside the ascii table myFont
+char myDregree [8]  = {
+0x00,0x00,0x0C,0x12,0x12,0x0C,0x00,0x00
+};
+
+
+// Small 8x8 font
+char myFont[][8]  = {
+{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00},
+{0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00},
+{0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00},
+{0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00},
+{0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00},
+{0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00},
+{0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00},
+{0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00},
+{0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00},
+{0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00},
+{0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
+{0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00},
+{0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00},
+{0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00},
+{0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00},
+{0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00},
+{0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00},
+{0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00},
+{0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00},
+{0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00},
+{0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00},
+{0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00},
+{0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00},
+{0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00},
+{0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00},
+{0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00},
+{0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00},
+{0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00},
+{0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00},
+{0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00},
+{0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00},
+{0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00},
+{0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00},
+{0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00},
+{0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00},
+{0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00},
+{0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00},
+{0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00},
+{0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00},
+{0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00},
+{0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00},
+{0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00},
+{0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00},
+{0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00},
+{0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00},
+{0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00},
+{0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00},
+{0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00},
+{0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00},
+{0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00},
+{0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00},
+{0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00},
+{0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00},
+{0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00},
+{0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00},
+{0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00},
+{0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00},
+{0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00},
+{0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00},
+{0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00},
+{0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00},
+{0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00},
+{0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00},
+{0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00},
+{0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00},
+{0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00},
+{0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00},
+{0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00},
+{0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00},
+{0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00},
+{0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00},
+{0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00},
+{0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00},
+{0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00},
+{0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00},
+{0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00},
+{0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00},
+{0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00},
+{0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00},
+{0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00},
+{0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00},
+{0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00},
+{0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00},
+{0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00},
+{0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00},
+{0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00},
+{0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00},
+{0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},
+{0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00},
+{0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00},
+{0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00} 
+};
+
+//*************************************************************************************************
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,157 @@
+#include "mbed.h"
+#include <time.h>
+#include "CriusOLED.h"
+#include "HCSR04.h"
+#include "AutomationElements.h"
+#include "DS1302.h"
+#include  "AM2320.h"
+
+//全局变量
+DigitalOut led(LED1);
+DigitalOut RST(D6);
+char buffer1[20],buffer2[50],buffer3[20];
+time_t rawtime;
+struct tm timeinfo;
+//Comment this line if the DS1302 is already running
+//#define INITIAL_RUN
+#define SCLK     A0
+#define IO      A1
+#define CE      A3
+DS1302 clk(SCLK, IO, CE);
+
+//AM2320初始化
+AM2320 am2320(i2c);
+int h;
+int t;
+//BME280初始化
+#include "BME280.h"
+BME280 bme280(I2C_SDA, I2C_SCL);
+
+Serial pc(SERIAL_TX, SERIAL_RX,921600);
+
+HCSR04 sensor(D2, D3);
+float sampleTime = 0.5;
+PT1 filter(1, 2, sampleTime);
+Ticker ticker;
+float Distance;
+float filtereddistance; 
+
+void calc() {
+    sensor.startMeasurement();
+}
+
+#include "ESP8266.h"
+//esp8266
+ESP8266 wifi(A7, A2, 921600); // baud rate for wifi
+char snd[300],rcv[500];
+#define IP "184.106.153.149" // thingspeak.com IP Address
+#define IP1 "link.tlink.io" // tlink.io IP Address
+#define IP2 "tcp.lewei50.com" //tcp.lewei50.com IP Address
+#define IP3 "api.heclouds.com"   //http onenet IP Address
+uint8_t esp8266_time;
+AnalogIn inputPin(A6); // temp
+
+void esp82666()
+{
+   switch(esp8266_time)
+   {
+    case 0:RST=0;wait(0.001);RST=1;break;
+    case 7:  strcpy(snd,"AT+CIPMODE=0");wifi.SendCMD(snd);break;//Setting WiFi into MultiChannel mode
+    case 8:  strcpy(snd,"AT+CIPMUX=1");wifi.SendCMD(snd);break;//Setting WiFi into MultiChannel mode
+    }
+   switch(esp8266_time%40)
+   {
+    case 9:  sprintf(snd,"AT+CIPSTART=1,\"TCP\",\"%s\",80",IP3);wifi.SendCMD(snd);break;//Initiate connection with onenet server 
+    case 10: strcpy(snd,"AT+CIPSEND=1,200");wifi.SendCMD(snd);wait(0.001);
+             sprintf(snd,"POST /devices/4605176/datapoints?type=3 HTTP/1.1\r\n"
+                         "api-key: bryNFvy6sbj9Isu5mHXp3fwIvtc=\r\n"
+                         "Host:api.heclouds.com\r\n"
+                         "Connection:close\r\n"
+                         "Content-Length:49\r\n"
+                         "\r\n"
+                         "{\"juli\":%03.2f,\"time\":%010d,\"mq135\":%02.2f}\r\n",
+                         Distance,rawtime,inputPin.read()*100);wifi.SendCMD(snd);break;
+    case 11: sprintf(snd,"AT+CIPSTART=2,\"TCP\",\"%s\",9960",IP2);wifi.SendCMD(snd);break;//Initiate connection with tcp.lewei50.com server   
+    case 12: strcpy(snd,"AT+CIPSEND=2,87");wifi.SendCMD(snd);wait(0.001);//Send Number of open connections,Characters to send 
+             strcpy(snd,"{\"method\": \"update\",\"gatewayNo\": \"01\",\"userkey\": \"e84c3784af864fb0bb70fd33cb434a45\"}&^!");wifi.SendCMD(snd);break;//Post values to cp.lewei50.com
+    case 13: strcpy(snd,"AT+CIPSEND=2,104");wifi.SendCMD(snd);wait(0.001);//Send Number of open connections,Characters to send 
+             sprintf(snd,"{\"method\": \"upload\",\"data\":[{\"Name\":\"shidu\",\"Value\":\"%2.4f\"},{\"Name\":\"wendu\",\"Value\":\"%010d\"}]}&^!",inputPin.read(),rawtime);wifi.SendCMD(snd);break;//Post values to tcp.lewei50.com 
+    case 14: sprintf(snd,"AT+CIPSTART=4,\"TCP\",\"%s\",80",IP);wifi.SendCMD(snd);break;//Initiate connection with THINGSPEAK server 
+    case 15: strcpy(snd,"AT+CIPSEND=4,46");wifi.SendCMD(snd);wait(0.001);//Send Number of open connections,Characters to send 
+             sprintf(snd,"GET /update?key=YPEAG0PP1LZ9ZUY5&field2=%2.2f\r\n",inputPin.read());wifi.SendCMD(snd);break;//Post values to thingspeak
+    case 16: sprintf(snd,"AT+CIPSTART=3,\"TCP\",\"%s\",8647",IP1);wifi.SendCMD(snd);break;//Initiate connection with THINGSPEAK server 
+    case 17: strcpy(snd,"AT+CIPSEND=3,16");wifi.SendCMD(snd);wait(0.001);//Send Number of open connections,Characters to send 
+             strcpy(snd,"3L0P2M2S3P9061I6");wifi.SendCMD(snd);clear_display();break;//Send Number of open connections,Characters to send 
+   } 
+    if(esp8266_time%40>=18)
+    {
+     strcpy(snd,"AT+CIPSEND=3,30");wifi.SendCMD(snd);wait(0.001);
+     sprintf(snd,"DTU%2.4f,%010d,%04.4f",inputPin.read(),rawtime,Distance);wifi.SendCMD(snd);   
+    }
+   ++esp8266_time;
+}
+
+int main()
+{
+    //IIC初始化
+    i2c.frequency(400000);
+    
+    //初始化OLED12864
+    init_OLED();
+    displayOn();
+    reset_display();
+    
+    // Initialize HCSR04
+    sensor.setRanges(2, 500);
+    ticker.attach(&calc, sampleTime);
+    
+    //如果程序需要,可以手动设定ds1302的时间 
+    #ifdef INITIAL_RUN
+    timeinfo.tm_year = 2017-1900;
+    timeinfo.tm_mon = 1-1;
+    timeinfo.tm_mday = 7;
+    timeinfo.tm_hour=15;
+    timeinfo.tm_min=45;
+    timeinfo.tm_sec=0;
+    timeinfo.tm_wday=6-1;
+    clk.set_time(mktime(&timeinfo));
+    #endif
+    //时间设定,将ds1302时间写入MCU中,程序时间读取通过MCU嘀嗒时钟   
+    rawtime = clk.time(NULL);
+    set_time(rawtime);  
+    
+    pc.printf("STM32L432 Initializing OK\r\n");
+    RST=1;
+    while(1) {
+        //测量距离
+        while(!sensor.isNewDataReady()) {
+        }
+        //led闪亮表示程序运行
+        led=!led;
+        
+        //测量并显示距离
+        Distance = sensor.getDistance_cm();
+        filter.in(Distance);
+        filtereddistance = filter.out();
+        snprintf(buffer1, 20, "%3.1fcm %3.1fcm   ",Distance, filtereddistance);    
+        sendStrXY(buffer1,2,0);         // pc.printf(buffer1);          
+        
+        //显示MCU读取时间
+        rawtime = time(NULL);
+        snprintf(buffer2, 50, "%s %10d %4.2f%%",ctime(&rawtime),rawtime,inputPin.read()*100); 
+        sendStrXY(buffer2,3,0);
+        
+        //AM2320读取数据
+        h = am2320.humidity();
+        t = am2320.temperature();
+        snprintf(buffer3, 20, "%3d.%dc %3d.%d%%",t/10,t%10,h/10,h%10); 
+        sendStrXY(buffer3,6,0);
+        
+        //bme280读取数据
+        snprintf(buffer1,sizeof(buffer1), "%2.2fC %6.0fPa",bme280.getTemperature(), bme280.getPressure()*100); 
+        sendStrXY(buffer1,7,0); 
+        
+        //ESP8266执行操作
+        esp82666();        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 11 16:57:18 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/99b5ccf27215
\ No newline at end of file