日B视频 亚洲,啪啪啪网站一区二区,91色情精品久久,日日噜狠狠色综合久,超碰人妻少妇97在线,999青青视频,亚洲一区二卡,让本一区二区视频,日韩网站推荐

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

如何創(chuàng)建一個Arduino控制的廚房計時器

454398 ? 來源:工程師吳畏 ? 2019-08-05 10:39 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

廚房定時器用戶界面流程

打開電源后,設備將顯示“Arduino Kitchen Timer”消息3秒鐘。

然后計時器將提示您設置時間。您可以通過按左右鍵將光標移動到分鐘和小時。

您可以使用向上和向下箭頭鍵調整分鐘和小時設置。

設置了所需的時間后,按下選擇按鈕,計時器將啟動。

如果您想再次設置時間,請再次按下選擇按鈕。

一旦時間結束,蜂鳴器將發(fā)出蜂鳴聲。

要停止蜂鳴器,請按鍵盤護罩上的重置按鈕。

廚房定時器所需的組件

Arduino

LCD鍵盤護盾

蜂鳴器

廚房定時器的電路圖

首先,對齊并放置L CD Keypad直接屏蔽Arduino。然后將蜂鳴器的正極連接到Arduino上的引腳12,將蜂鳴器的負極連接到地面。

Arduino廚房定時器項目代碼

將以下代碼復制并上傳到Arduino IDE中。代碼的每個部分都有一個附帶的解釋,以幫助您了解它的功能。

#include

// select the pins used for the LCD keypad

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// define some variables

int lcd_key = 0;

int adc_key_in = 0;

int hrs = 0;

int mins = 0;

int set_mins = 0;

int set_hrs = 1;

int secs = 60;

int cursor_pos = 1;

int buzzer_pin = 12;

bool startTimer = false;

bool setTimer = true;

bool get_time = false;

unsigned long interval=1000; // the time we need to wait

unsigned long previousMillis=0; // millis() returns an unsigned long.

// Defining button used by the lcd keypad

#define btnRIGHT 0

#define btnUP 1

#define btnDOWN 2

#define btnLEFT 3

#define btnSELECT 4

#define btnNONE 5

// read the buttons

int read_LCD_buttons()

{

adc_key_in = analogRead(0); // reading the button value from the lcd keypad

// checking which button is pressed

if (adc_key_in 》 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result

if (adc_key_in 《 50) return btnRIGHT;

if (adc_key_in 《 250) return btnUP;

if (adc_key_in 《 450) return btnDOWN;

if (adc_key_in 《 650) return btnLEFT;

if (adc_key_in 《 850) return btnSELECT;

return btnNONE; // when all others fail, return this.。.

}

void setup()

{

Serial.begin(115200);

pinMode(buzzer_pin, OUTPUT);

lcd.begin(16, 2); // start communication with LCD keypad shield

lcd.setCursor(0,0);

lcd.print(“Arduino Kitchen”);

lcd.setCursor(0, 1);

lcd.print(“ Timer”);

delay(3000);

}

void loop(){

// Checking which condition is true based on the button pressed

if(startTimer == true){

start_timer();

}

else if (setTimer == true){

set_timer();

}

}

// This function will count the time and will beep the buzzer when the time will be up.

void start_timer(){

// Checking whether time is up or not

if(hrs == 0 && mins == 0 && secs == 0){

lcd.setCursor(0, 0);

lcd.print(“ Time is UP”);

lcd.setCursor(0, 1);

lcd.print(“ Beep Beep”);

digitalWrite(buzzer_pin, HIGH);

delay(500);

digitalWrite(buzzer_pin, LOW);

delay(500);

}

else if(secs 《 0){

secs = 59;

mins = mins - 1;

}

else if(mins 《 0){

mins = 59;

hrs = hrs - 1;

}

else

{

get_time = true;

counter();

lcd.setCursor(0, 0);

lcd.print(“Timer is ON”);

lcd.setCursor(0, 1);

lcd.print(hrs);

lcd.print(“:”);

lcd.setCursor(4, 1);

lcd.print(mins);

lcd.print(“:”);

lcd.setCursor(8, 1);

lcd.print(secs);

}

lcd_key = read_LCD_buttons(); // read the buttons

switch (lcd_key) // depending on which button was pushed, we perform an action

{

// if select button is pressed, move back to set time

case btnSELECT:

{

startTimer = false;

setTimer = true;

delay(300);

lcd.clear();

break;

}

case btnNONE:

{

break;

}

}

}

// This function will set the time

void set_timer(){

counter();

lcd.setCursor(0, 0);

lcd.print(“Set Time”);

lcd.setCursor(0, 1);

lcd.print(“Hrs:”);

lcd.print(hrs);

lcd.setCursor(8, 1);

lcd.print(“Mins:”);

lcd.print(mins);

lcd.setCursor(0,1);

lcd_key = read_LCD_buttons(); // read the buttons

switch (lcd_key) // depending on which button was pushed, we perform an action

{

// if right button is pressed, then move the cursor to minutes

case btnRIGHT:

{

cursor_pos = set_mins;

break;

}

// if left button is pressed, then move the cursor to hours

case btnLEFT:

{

cursor_pos = set_hrs;

break;

}

// if up button is pressed, add 1 to the minutes or hours

case btnUP:

{

delay(300);

if(cursor_pos == set_mins){

mins++;

if(mins 》 59){

mins = 0;

}

}

else if(cursor_pos == set_hrs){

hrs++;

if(hrs 》 24){

hrs = 0;

}

}

break;

}

// if down button is pressed, minus 1 from the minutes or hours

case btnDOWN:

{

delay(300);

if(cursor_pos == set_mins){

mins--;

if(mins 《 0){

mins = 60;

}

}

else if(cursor_pos == set_hrs){

hrs--;

if(hrs 《 0){

hrs = 24;

}

}

break;

}

// if select button is pressed, start the timer

case btnSELECT:

{

startTimer = true;

setTimer = false;

mins = mins - 1;

delay(300);

break;

}

case btnNONE:

{

break;

}

}

}

void counter() {

unsigned long currentMillis = millis(); // grab current time

// check if “interval” time has passed (1000 milliseconds)

if ((unsigned long)(currentMillis - previousMillis) 》= interval) {

lcd.clear();

if(get_time == true){

secs--;

get_time = false;

}

previousMillis = millis();

}

}

創(chuàng)建廚房計時器只是一個開始!

您已經創(chuàng)建了自己的廚房計時器!該項目的最佳部分是能夠調整該模塊以構建其他項目,這些項目需要LCD和按鈕或蜂鳴器之間的簡單接口。您還可以為模塊設計自定義3D打印的外殼,并使其成為您自己的。

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規(guī)問題,請聯系本站處理。 舉報投訴
  • 計時器
    +關注

    關注

    1

    文章

    435

    瀏覽量

    35405
  • Arduino
    +關注

    關注

    190

    文章

    6529

    瀏覽量

    197563
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關推薦
    熱點推薦

    客戶案例分享 | 毫秒定勝負,這款賽事級連接守護成績公正

    體育賽事計時器競技體育中,毫秒決勝負賽事計時器,捍衛(wèi)成績公正它通過高速攝影與信號同步精準保障賽事結果不偏不倚而高可靠的電源和信號連接便是賽事計時器穩(wěn)定電氣連接的關鍵體育賽事
    的頭像 發(fā)表于 04-07 19:58 ?156次閱讀
    客戶案例分享 | 毫秒定勝負,這款賽事級連接<b class='flag-5'>器</b>守護成績公正

    Linux內核的“心跳”:jiffies如何為系統(tǒng)計時?

    在 Linux 內核的世界里,有默默工作的 "計時器"——jiffies。它不像我們手機上的時鐘那樣顯示年月日,卻掌控著內核中絕大多數時間相關的操作:從進程調度到設備驅動的定時檢查,都離不開它的身影。
    的頭像 發(fā)表于 02-04 16:27 ?958次閱讀
    Linux內核的“心跳”:jiffies如何為系統(tǒng)<b class='flag-5'>計時</b>?

    探索用于Arduino的TLE94112ES直流電機控制盾牌

    探索用于Arduino的TLE94112ES直流電機控制盾牌 引言 在電子工程領域,電機控制直是至關重要的部分。對于Arduino開發(fā)者而
    的頭像 發(fā)表于 12-18 16:35 ?556次閱讀

    在進行低功耗設計時如何優(yōu)化CW32L083系列微控制器的功耗?

    在進行低功耗設計時,如何優(yōu)化CW32L083系列微控制器的功耗?
    發(fā)表于 12-16 06:03

    TE Connectivity RAST 2.5標準計時器壓接連接:家用電器連接的可靠解決方案

    TE Connectivity (TE) RAST 2.5標準計時器壓接連接設計用于輕松可靠地連接家用電器和洗衣機應用。該連接采用薄型設計,壓接版本非常適合用于雙絕緣電線和PVC管密封式電線
    的頭像 發(fā)表于 11-04 09:16 ?864次閱讀

    創(chuàng)建Library工程

    創(chuàng)建Library工程 首先選中 File -&gt; New -&gt; C/C++ Project,在彈出的框中,選擇Static Library
    發(fā)表于 10-20 09:30

    耐電痕化指數測定儀:滴液計時器設置與終點判據的深度解讀

    、滴液計時器:模擬環(huán)境的“節(jié)奏控制器”? 耐電痕化測試的核心是復刻絕緣材料在潮濕污染環(huán)境中的劣化過程,滴液計時器則是把控這過程節(jié)奏的關鍵
    的頭像 發(fā)表于 10-16 09:46 ?509次閱讀
    耐電痕化指數測定儀:滴液<b class='flag-5'>計時器</b>設置與終點判據的深度解讀

    智能藍牙廚房秤方案開發(fā)設計

    隨著人們對健康飲食和烹飪便捷性的追求,傳統(tǒng)的廚房秤已經無法滿足人們的需求?,F在,借助輝芒微8位MCU,我們可以打造款智能藍牙廚房秤,它不僅具備高精度的稱重功能,還能通過藍牙與手機無縫連接,實現數據
    的頭像 發(fā)表于 08-26 16:09 ?965次閱讀
    智能藍牙<b class='flag-5'>廚房</b>秤方案開發(fā)設計

    如何用Arduino Nano/UNO R3開發(fā)板給另一個Arduino IDE不能下載的Arduino Nano/UNO R3開發(fā)板重新燒錄引導程序bootlaoder

    本文介紹了如何用能夠Arduino IDE下載的Arduino Nano/UNO R3開發(fā)板給另一個Arduino IDE不能下載的Arduino
    的頭像 發(fā)表于 08-08 20:16 ?4024次閱讀
    如何用<b class='flag-5'>Arduino</b> Nano/UNO R3開發(fā)板給另<b class='flag-5'>一個</b><b class='flag-5'>Arduino</b> IDE不能下載的<b class='flag-5'>Arduino</b> Nano/UNO R3開發(fā)板重新燒錄引導程序bootlaoder

    零知開源——基于STM32F407VET6零知增強板的四路獨立計時器

    獨立控制,支持開始、暫停和重置功能,并具備定時報警功能(4小時或每小時觸發(fā))。項目結合了TFT顯示屏、蜂鳴器和按鈕控制,提供了直觀的用戶界面。核心功能 >四路獨立
    發(fā)表于 07-01 10:31

    零知開源——基于STM32F407VET6零知增強板的四路獨立計時器

    本教程介紹基于STM32F407VET6零知增強板的四路獨立計時器實現方案。項目采用TFT顯示屏、蜂鳴器和按鈕構建交互系統(tǒng),支持各計時器獨立控制(開始/暫停/重置)和智能報警(4小時及以上每小時觸發(fā)
    的頭像 發(fā)表于 07-01 10:13 ?1612次閱讀
    零知開源——基于STM32F407VET6零知增強板的四路獨立<b class='flag-5'>計時器</b>

    基于STM32F407VET6零知增強板的四路獨立計時器

    計時器
    PCB56242069
    發(fā)布于 :2025年07月01日 09:41:44

    納祥科技客戶案例 | 集計時、照明、裝飾于體的電子沙漏計時器方案

    傳統(tǒng)沙漏作為計時工具,雖具備儀式感,但存在功能單、無法實時調整具體定時等局限性。應客戶需求,納祥科技推出了結合LED顯示、重力感應、低功耗等技術的電子沙漏計時器方案,實現傳統(tǒng)沙漏的美學與現代
    的頭像 發(fā)表于 06-13 16:32 ?1097次閱讀
    納祥科技客戶案例 | 集<b class='flag-5'>計時</b>、照明、裝飾于<b class='flag-5'>一</b>體的電子沙漏<b class='flag-5'>計時器</b>方案

    基于瑞薩RX13T系列微控制器的工業(yè)直流無刷風機解決方案

    瑞薩電子和鈴岳電子于近日聯合推出了RX13T工業(yè)直流無刷風機解決方案,方案搭載了瑞薩RX13T系列微控制器,RX13T搭載RX家族32MHz工作主頻的RXv1內核、浮點運算單元(FPU)、變頻控制計時器(MTU3)及12位A/D
    的頭像 發(fā)表于 06-10 14:05 ?2050次閱讀
    基于瑞薩RX13T系列微<b class='flag-5'>控制器</b>的工業(yè)直流無刷風機解決方案

    《ESP32S3 Arduino開發(fā)指南》第二章 Arduino基礎知識

    ()和loop()兩函數組成。1、setup()Arduino控制器通電后或復位后,會開始執(zhí)行setup()函數中的程序,該程序只會執(zhí)行次。通常是在setup()函數中完成
    發(fā)表于 05-13 09:28
    冷水江市| 绿春县| 定州市| 汕尾市| 吴旗县| 淳化县| 定结县| 北宁市| 微山县| 寿光市| 绥化市| 秭归县| 建水县| 会昌县| 潮州市| 沧州市| 民勤县| 茶陵县| 格尔木市| 临武县| 东源县| 泰和县| 馆陶县| 巢湖市| 桐柏县| 贡山| 石林| 南平市| 桂阳县| 盐山县| 左贡县| 霸州市| 张家川| 馆陶县| 昌平区| 乌鲁木齐县| 宜城市| 竹山县| 资溪县| 台东市| 疏勒县|