国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

嵌入式畢設(shè)分享 基于單片機(jī)的風(fēng)速測(cè)量系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式 stm32 arduino

這篇具有很好參考價(jià)值的文章主要介紹了嵌入式畢設(shè)分享 基于單片機(jī)的風(fēng)速測(cè)量系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式 stm32 arduino。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。


0 前言

?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。

為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天要分享的是

?? 基于單片機(jī)的風(fēng)速測(cè)量系統(tǒng)

??學(xué)長(zhǎng)這里給一個(gè)題目綜合評(píng)分(每項(xiàng)滿分5分)

  • 難度系數(shù):4分
  • 工作量:4分
  • 創(chuàng)新點(diǎn):3分

1 簡(jiǎn)介

基于Arduino單片機(jī)的風(fēng)速計(jì)測(cè)量系統(tǒng),使用Adafruit風(fēng)速計(jì)傳感器模塊和Arduino開發(fā)板測(cè)量風(fēng)速。風(fēng)速計(jì)是用于測(cè)量風(fēng)速和風(fēng)向的設(shè)備,它也是一種非常常見的氣象站儀器。

在所有涉及風(fēng)速測(cè)量的研究中,例如氣象學(xué)、風(fēng)力渦輪機(jī)和農(nóng)業(yè),我們需要準(zhǔn)確的風(fēng)速信息來(lái)進(jìn)行決策。市面上有幾種類型的風(fēng)速計(jì),如風(fēng)杯、熱線和皮托管。這里使用的風(fēng)速計(jì)是杯型風(fēng)速計(jì)。

2 主要器件

  • Arduino Nano開發(fā)板
  • Adafruit風(fēng)速計(jì)傳感器
  • 0.96寸I2C OLED顯示屏
  • MT3608升壓轉(zhuǎn)換器模塊
  • 3.7V鋰離子電池

3 實(shí)現(xiàn)效果

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)

4 硬件設(shè)計(jì)

風(fēng)速計(jì)簡(jiǎn)介

本項(xiàng)目,我們使用的風(fēng)速計(jì)傳感器是Adafruit公司的風(fēng)速計(jì)。Adafruit風(fēng)速計(jì)能夠測(cè)量高達(dá)70m/s或156mph的風(fēng)速,這對(duì)于我們來(lái)說應(yīng)該足夠了。我們可以將Adafruit風(fēng)速計(jì)傳感器與Arduino和OLED顯示屏連接起來(lái)。傳感器將以m/s為單位測(cè)量風(fēng)速,然后在OLED屏幕上顯示該值。您可以將風(fēng)速?gòu)膍/s轉(zhuǎn)換為英里/小時(shí)或公里/小時(shí)。

風(fēng)速計(jì)(Anemometer)是用于測(cè)量風(fēng)速和風(fēng)向的設(shè)備。它廣泛用于測(cè)量大氣、風(fēng)洞和其他氣流應(yīng)用中的氣流速度。該術(shù)語(yǔ)源自希臘語(yǔ) anemos,意思是風(fēng),用于描述氣象學(xué)中使用的任何風(fēng)速儀器。

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)

用于風(fēng)速測(cè)量的最廣泛使用的風(fēng)速計(jì)是轉(zhuǎn)杯式電動(dòng)風(fēng)速計(jì)。旋轉(zhuǎn)風(fēng)杯驅(qū)動(dòng)發(fā)電機(jī)。發(fā)電機(jī)的輸出運(yùn)行一個(gè)在風(fēng)速中校準(zhǔn)的電表。三杯風(fēng)速計(jì)目前被用作風(fēng)資源評(píng)估研究和實(shí)踐的行業(yè)標(biāo)準(zhǔn)。

杯型風(fēng)速計(jì)由安裝在水平臂上的3或4個(gè)半球形杯組成,這些杯安裝在垂直軸上。在任何水平方向通過杯子的氣流以大致與風(fēng)速成比例的速度轉(zhuǎn)動(dòng)軸。因此,在設(shè)定的時(shí)間間隔內(nèi)計(jì)算軸的轉(zhuǎn)數(shù)會(huì)產(chǎn)生一個(gè)與速度范圍內(nèi)的平均風(fēng)速成比例的值。

Adafruit風(fēng)速計(jì)傳感器

Adafruit風(fēng)速計(jì)傳感器是一種三杯型風(fēng)速計(jì),能夠測(cè)量高達(dá) 70m/s 或 156mph 的風(fēng)速。它由外殼、風(fēng)杯、電路模塊組成。

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)
傳感器配有3芯電纜。黑色線連接電源信號(hào)地,棕色線用于電源,可以是7-24v DC,第三根藍(lán)色線通過模擬電壓提供測(cè)量值。輸出模擬電壓范圍為0.4V(0 m/s 風(fēng))至 2.0V(32.4m/s 風(fēng))。

傳感器模塊的規(guī)格

  1. 所需電壓:7-24v DC

  2. 輸出:0.4V至2V

  3. 測(cè)試范圍:0.5m/s至50m/s

  4. 啟動(dòng)風(fēng)速:0.2m/s

  5. 分辨率:0.1m/s

  6. 精度:最差情況1米/秒

  7. 最大風(fēng)速:70m/s

  8. 引腳: 1 – 電源 (棕色線), 2 – 地 (黑色線), 3 – 信號(hào) (藍(lán)色線)

傳感器的內(nèi)部電路

去除掉外殼后就可以傳感器。內(nèi)部電路包含集成到內(nèi)部驅(qū)動(dòng)器中的光伏模塊、工業(yè)處理器、電流發(fā)生器。

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)
電路PCB的材料為軍工A級(jí),保證了參數(shù)的穩(wěn)定性和電性能的質(zhì)量。內(nèi)部電子元件均為工業(yè)級(jí)芯片,具有極其可靠的抗電磁干擾能力。內(nèi)部系統(tǒng)可在–20℃~+50℃,濕度35%~85%下正常工作。

電纜的插頭是軍用插頭。具有良好的防腐和防侵蝕性能,可確保儀器長(zhǎng)期使用。

原理圖或電路

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)
dafruit 風(fēng)速計(jì)在7-24VDC 之間工作。所以Arduino的電壓不足以啟動(dòng)傳感器。因此,必須使用MT3608 DC-DC升壓轉(zhuǎn)換器模塊將鋰離子電池的3.7V升壓至7.5V。要調(diào)整輸出電壓,首先將電池連接到MT3608模塊的輸入端,然后旋轉(zhuǎn)電位器,直到萬(wàn)用表上的輸出電壓顯示為7.5V。

傳感器的VCC和Arduino的Vin引腳由升壓轉(zhuǎn)換器模塊的輸出提供7.5V。作為風(fēng)速計(jì)傳感器模擬輸出引腳的藍(lán)線連接到Arduino開發(fā)板的A0。OLED顯示屏的I2C引腳,即SDA和SCL連接到Arduino的A4和A5。 OLED顯示屏由Arduino的3.3V引腳提供電壓。

stm32 讀取脈沖輸出型風(fēng)速傳感器,單片機(jī)

5 軟件說明

Arduino風(fēng)速計(jì)的源代碼/程序

以下是使用Arduino IDE編寫的簡(jiǎn)易Arduino風(fēng)速計(jì)代碼。編譯Arduino風(fēng)速計(jì)項(xiàng)目代碼并上傳到Arduino開發(fā)板。您可以將風(fēng)速更改為m/s 或 mph。

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!"); 
 
  tft.begin();

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 
  
  Serial.println(F("Benchmark                Time (microseconds)"));
  delay(10);
  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(500);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(500);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(500);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(500);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(500);

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(500);

  Serial.print(F("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(500);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(500);

  Serial.print(F("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(500);

  Serial.println(F("Done!"));

}


void loop(void) {
  for(uint8_t rotation=0; rotation<4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  tft.fillScreen(ILI9341_RED);
  yield();
  tft.fillScreen(ILI9341_GREEN);
  yield();
  tft.fillScreen(ILI9341_BLUE);
  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  yield();
  
  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  yield();
  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  for(i=n; i>0; i-=6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
    yield();
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                w = tft.width()  + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  for(i=0; i<n; i+=5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(i, i, i));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i*10, i*10));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i*10, i*10, 0));
    yield();
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()); i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
    yield();
  }

  return micros() - start;
}

SSD1306屏幕代碼文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-828708.html

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

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

/* Comment out above, uncomment this block to use hardware SPI
#define OLED_DC     6
#define OLED_CS     7
#define OLED_RESET  8
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  &SPI, OLED_DC, OLED_RESET, OLED_CS);
*/

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ 0b00000000, 0b11000000,
  0b00000001, 0b11000000,
  0b00000001, 0b11000000,
  0b00000011, 0b11100000,
  0b11110011, 0b11100000,
  0b11111110, 0b11111000,
  0b01111110, 0b11111111,
  0b00110011, 0b10011111,
  0b00011111, 0b11111100,
  0b00001101, 0b01110000,
  0b00011011, 0b10100000,
  0b00111111, 0b11100000,
  0b00111111, 0b11110000,
  0b01111100, 0b11110000,
  0b01110000, 0b01110000,
  0b00000000, 0b00110000 };

void setup() {
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  display.display();
  delay(2000);
  // display.display() is NOT necessary after every single drawing command,
  // unless that's what you want...rather, you can batch up a bunch of
  // drawing operations and then update the screen all at once by calling
  // display.display(). These examples demonstrate both approaches...

  testdrawline();      // Draw many lines

  testdrawrect();      // Draw rectangles (outlines)

  testfillrect();      // Draw rectangles (filled)

  testdrawcircle();    // Draw circles (outlines)

  testfillcircle();    // Draw circles (filled)

  testdrawroundrect(); // Draw rounded rectangles (outlines)

  testfillroundrect(); // Draw rounded rectangles (filled)

  testdrawtriangle();  // Draw triangles (outlines)

  testfilltriangle();  // Draw triangles (filled)

  testdrawchar();      // Draw characters of the default font

  testdrawstyles();    // Draw 'stylized' characters

  testscrolltext();    // Draw scrolling text

  testdrawbitmap();    // Draw a small bitmap image

  // Invert and restore display, pausing in-between
  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);

  testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}

void loop() {
}

void testdrawline() {
  int16_t i;

  display.clearDisplay(); // Clear display buffer

  for(i=0; i<display.width(); i+=4) {
    display.drawLine(0, 0, i, display.height()-1, SSD1306_WHITE);
    display.display(); // Update screen with each newly-drawn line
    delay(1);
  }
  for(i=0; i<display.height(); i+=4) {
    display.drawLine(0, 0, display.width()-1, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=0; i<display.width(); i+=4) {
    display.drawLine(0, display.height()-1, i, 0, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=display.height()-1; i>=0; i-=4) {
    display.drawLine(0, display.height()-1, display.width()-1, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=display.width()-1; i>=0; i-=4) {
    display.drawLine(display.width()-1, display.height()-1, i, 0, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=display.height()-1; i>=0; i-=4) {
    display.drawLine(display.width()-1, display.height()-1, 0, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=0; i<display.height(); i+=4) {
    display.drawLine(display.width()-1, 0, 0, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=0; i<display.width(); i+=4) {
    display.drawLine(display.width()-1, 0, i, display.height()-1, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000); // Pause for 2 seconds
}

void testdrawrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2; i+=2) {
    display.drawRect(i, i, display.width()-2*i, display.height()-2*i, SSD1306_WHITE);
    display.display(); // Update screen with each newly-drawn rectangle
    delay(1);
  }

  delay(2000);
}

void testfillrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2; i+=3) {
    // The INVERSE color is used so rectangles alternate white/black
    display.fillRect(i, i, display.width()-i*2, display.height()-i*2, SSD1306_INVERSE);
    display.display(); // Update screen with each newly-drawn rectangle
    delay(1);
  }

  delay(2000);
}

void testdrawcircle(void) {
  display.clearDisplay();

  for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) {
    display.drawCircle(display.width()/2, display.height()/2, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfillcircle(void) {
  display.clearDisplay();

  for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) {
    // The INVERSE color is used so circles alternate white/black
    display.fillCircle(display.width() / 2, display.height() / 2, i, SSD1306_INVERSE);
    display.display(); // Update screen with each newly-drawn circle
    delay(1);
  }

  delay(2000);
}

void testdrawroundrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2-2; i+=2) {
    display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i,
      display.height()/4, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfillroundrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2-2; i+=2) {
    // The INVERSE color is used so round-rects alternate white/black
    display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i,
      display.height()/4, SSD1306_INVERSE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testdrawtriangle(void) {
  display.clearDisplay();

  for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) {
    display.drawTriangle(
      display.width()/2  , display.height()/2-i,
      display.width()/2-i, display.height()/2+i,
      display.width()/2+i, display.height()/2+i, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfilltriangle(void) {
  display.clearDisplay();

  for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) {
    // The INVERSE color is used so triangles alternate white/black
    display.fillTriangle(
      display.width()/2  , display.height()/2-i,
      display.width()/2-i, display.height()/2+i,
      display.width()/2+i, display.height()/2+i, SSD1306_INVERSE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testdrawchar(void) {
  display.clearDisplay();

  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE); // Draw white text
  display.setCursor(0, 0);     // Start at top-left corner
  display.cp437(true);         // Use full 256 char 'Code Page 437' font

  // Not all the characters will fit on the display. This is normal.
  // Library will draw what it can and the rest will be clipped.
  for(int16_t i=0; i<256; i++) {
    if(i == '\n') display.write(' ');
    else          display.write(i);
  }

  display.display();
  delay(2000);
}

void testdrawstyles(void) {
  display.clearDisplay();

  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0,0);             // Start at top-left corner
  display.println(F("Hello, world!"));

  display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
  display.println(3.141592);

  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.print(F("0x")); display.println(0xDEADBEEF, HEX);

  display.display();
  delay(2000);
}

void testscrolltext(void) {
  display.clearDisplay();

  display.setTextSize(2); // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 0);
  display.println(F("scroll"));
  display.display();      // Show initial text
  delay(100);

  // Scroll in various directions, pausing in-between:
  display.startscrollright(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrollleft(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrolldiagright(0x00, 0x07);
  delay(2000);
  display.startscrolldiagleft(0x00, 0x07);
  delay(2000);
  display.stopscroll();
  delay(1000);
}

void testdrawbitmap(void) {
  display.clearDisplay();

  display.drawBitmap(
    (display.width()  - LOGO_WIDTH ) / 2,
    (display.height() - LOGO_HEIGHT) / 2,
    logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
  display.display();
  delay(1000);
}

#define XPOS   0 // Indexes into the 'icons' array in function below
#define YPOS   1
#define DELTAY 2

void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
  int8_t f, icons[NUMFLAKES][3];

  // Initialize 'snowflake' positions
  for(f=0; f< NUMFLAKES; f++) {
    icons[f][XPOS]   = random(1 - LOGO_WIDTH, display.width());
    icons[f][YPOS]   = -LOGO_HEIGHT;
    icons[f][DELTAY] = random(1, 6);
    Serial.print(F("x: "));
    Serial.print(icons[f][XPOS], DEC);
    Serial.print(F(" y: "));
    Serial.print(icons[f][YPOS], DEC);
    Serial.print(F(" dy: "));
    Serial.println(icons[f][DELTAY], DEC);
  }

  for(;;) { // Loop forever...
    display.clearDisplay(); // Clear the display buffer

    // Draw each snowflake:
    for(f=0; f< NUMFLAKES; f++) {
      display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SSD1306_WHITE);
    }

    display.display(); // Show the display buffer on the screen
    delay(200);        // Pause for 1/10 second

    // Then update coordinates of each flake...
    for(f=0; f< NUMFLAKES; f++) {
      icons[f][YPOS] += icons[f][DELTAY];
      // If snowflake is off the bottom of the screen...
      if (icons[f][YPOS] >= display.height()) {
        // Reinitialize to a random position, just off the top
        icons[f][XPOS]   = random(1 - LOGO_WIDTH, display.width());
        icons[f][YPOS]   = -LOGO_HEIGHT;
        icons[f][DELTAY] = random(1, 6);
      }
    }
  }
}

5 最后

到了這里,關(guān)于嵌入式畢設(shè)分享 基于單片機(jī)的風(fēng)速測(cè)量系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式 stm32 arduino的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • STM32畢設(shè)分享 - 基于單片機(jī)的智能魚缸系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn) - 嵌入式 物聯(lián)網(wǎng) stm32 51單片機(jī) 智能魚缸

    STM32畢設(shè)分享 - 基于單片機(jī)的智能魚缸系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn) - 嵌入式 物聯(lián)網(wǎng) stm32 51單片機(jī) 智能魚缸

    Hi,大家好,今天向大家介紹一個(gè) 單片機(jī)項(xiàng)目, 大家可用于 課程設(shè)計(jì) 或 畢業(yè)設(shè)計(jì) 基于單片機(jī)的智能魚缸系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn) ?? 項(xiàng)目分享與指導(dǎo): https://gitee.com/sinonfin/sharing 近年以來(lái),隨著我國(guó)綜合實(shí)力飛速飆升,人們對(duì)物質(zhì)和精神生活質(zhì)量的要求也不斷提升,各式各樣的智能

    2024年04月11日
    瀏覽(28)
  • 【畢設(shè)選題技巧分享】單片機(jī) 嵌入式 物聯(lián)網(wǎng) 電子工程畢設(shè)如何選題

    【畢設(shè)選題技巧分享】單片機(jī) 嵌入式 物聯(lián)網(wǎng) 電子工程畢設(shè)如何選題

    每年畢業(yè)季最苦的就是學(xué)生了,學(xué)校課程教不了什么有用的東西,畢設(shè)系統(tǒng)里林林總總的題目讓人看得眼花,不同的選題可能決定你未來(lái)幾個(gè)月輕輕松松還是嘔心瀝血地完成畢設(shè),以及最后是否能拿到不錯(cuò)的分?jǐn)?shù)順利畢業(yè),本期來(lái)分享一些選題技巧,希望能幫助到同學(xué)們!

    2024年01月22日
    瀏覽(21)
  • stm32畢設(shè)分享 Stm32酒駕檢查系統(tǒng) - 單片機(jī) 嵌入式 物聯(lián)網(wǎng)

    stm32畢設(shè)分享 Stm32酒駕檢查系統(tǒng) - 單片機(jī) 嵌入式 物聯(lián)網(wǎng)

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年01月23日
    瀏覽(92)
  • stm32畢設(shè)分享 stm32實(shí)現(xiàn)車牌識(shí)別系統(tǒng) -物聯(lián)網(wǎng) 嵌入式 單片機(jī)

    stm32畢設(shè)分享 stm32實(shí)現(xiàn)車牌識(shí)別系統(tǒng) -物聯(lián)網(wǎng) 嵌入式 單片機(jī)

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年02月20日
    瀏覽(28)
  • stm32畢設(shè)分享 stm32智能運(yùn)動(dòng)計(jì)步系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式 單片機(jī)

    stm32畢設(shè)分享 stm32智能運(yùn)動(dòng)計(jì)步系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式 單片機(jī)

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年02月20日
    瀏覽(102)
  • stm32畢設(shè)分享 stm32單片機(jī)的遠(yuǎn)程WIFI密碼鎖 - 物聯(lián)網(wǎng) 嵌入式

    stm32畢設(shè)分享 stm32單片機(jī)的遠(yuǎn)程WIFI密碼鎖 - 物聯(lián)網(wǎng) 嵌入式

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年02月20日
    瀏覽(94)
  • stm32畢設(shè)分享 stm32單片機(jī)酒精濃度酒駕檢測(cè)系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式

    stm32畢設(shè)分享 stm32單片機(jī)酒精濃度酒駕檢測(cè)系統(tǒng) - 物聯(lián)網(wǎng) 嵌入式

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年02月20日
    瀏覽(92)
  • stm32畢設(shè)分享 單片機(jī)自動(dòng)寫字機(jī)器人設(shè)計(jì)與實(shí)現(xiàn) - 物聯(lián)網(wǎng) 嵌入式 stm32

    stm32畢設(shè)分享 單片機(jī)自動(dòng)寫字機(jī)器人設(shè)計(jì)與實(shí)現(xiàn) - 物聯(lián)網(wǎng) 嵌入式 stm32

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年01月21日
    瀏覽(106)
  • 畢設(shè)開源 基于stm32的智能平衡小車 - 單片機(jī) 物聯(lián)網(wǎng)嵌入式

    畢設(shè)開源 基于stm32的智能平衡小車 - 單片機(jī) 物聯(lián)網(wǎng)嵌入式

    文章目錄 0 前言 1 項(xiàng)目背景 2 設(shè)計(jì)思路 3 硬件設(shè)計(jì) 4 軟件設(shè)計(jì) 4.2 直立控制程序設(shè)計(jì) 4.3 速度控制程序設(shè)計(jì) 4.4 方向控制程序設(shè)計(jì) 4.5 關(guān)鍵代碼 5 最后 ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這

    2024年02月22日
    瀏覽(30)
  • stm32畢設(shè)分享 Stm32 WIFI智能家居溫濕度和煙霧檢測(cè)系統(tǒng) - 單片機(jī) 物聯(lián)網(wǎng) 嵌入式

    stm32畢設(shè)分享 Stm32 WIFI智能家居溫濕度和煙霧檢測(cè)系統(tǒng) - 單片機(jī) 物聯(lián)網(wǎng) 嵌入式

    ?? 這兩年開始畢業(yè)設(shè)計(jì)和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點(diǎn),往往達(dá)不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長(zhǎng)自己做的項(xiàng)目系統(tǒng)達(dá)不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長(zhǎng)分享優(yōu)質(zhì)畢業(yè)設(shè)計(jì)項(xiàng)目,今天

    2024年02月02日
    瀏覽(791)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包