Cov txheej txheem:

EF 230: Tsev Txheej Txheem 3000 Qhia: 4 Kauj Ruam
EF 230: Tsev Txheej Txheem 3000 Qhia: 4 Kauj Ruam

Video: EF 230: Tsev Txheej Txheem 3000 Qhia: 4 Kauj Ruam

Video: EF 230: Tsev Txheej Txheem 3000 Qhia: 4 Kauj Ruam
Video: Часы Casio Illuminator AQ-230A-1D [AQ-230A-1DVEF] - видео обзор | Watch-Forum.RU 2024, Kaum ib hlis
Anonim
EF 230: Tsev Txheej Txheem 3000 Qhia Tau
EF 230: Tsev Txheej Txheem 3000 Qhia Tau

Lub Tsev Hauv Tsev 3000 yog lub cuab yeej siv Arduino, ntsuas kub, ntsuas lub suab piezo, lub ntsuas ntsuas pom qhov muag/duab hluav taws xob, thiab servo los tso saib txoj hauv kev txhim kho kev siv hluav taws xob hauv tsev.

Kauj Ruam 1: Kub Sensor

Kub Sensor
Kub Sensor

· Khiav koj lub zog thiab cov xov hlau hauv av los ntawm

lub micro tswj mus rau sab ntawm lub khob cij board

· Muab qhov ntsuas kub tso rau hauv lub khob cij, thiab khiav lub zog sib xws thiab cov xov hlau hauv av kom haum

· Tshaj tawm tias qhov ntsuas kub muaj peb ntu, thiab qhov nruab nrab nruab nrab muaj cov xaim uas khiav los ntawm qhov chaw nres nkoj "A0".

· Txoj cai ntsuas kub:

teb = questdlg ('Thov khiav arduino thiab servo pib code', 'teb', 'Ok', 'Ok')

prompt = 'Nias ib qho yuam sij kom pib'

ncua

prompt1 = 'Teeb tsa qhov kub tsawg kawg'

x = input (prompt1)

prompt2 = 'Teeb tsa qhov siab tshaj plaws'

y = tawm tswv yim (prompt2)

prompt3 = 'nias ib qho yuam sij kom pib'

ncua

daim duab

h = animatedline;

ax = gca;

ax. YGrid = 'rau';

ax. YLim = [65 85];

nres = tsis tseeb;

startTime = datetime ('tam sim no');

thaum ~ nres

% Nyeem qhov nqi hluav taws xob tam sim no

v = readVoltage (a, 'A0');

% Xam qhov ntsuas kub ntawm qhov hluav taws xob (raws cov ntaub ntawv)

TempC = (v - 0.5)*100;

TempF = 9/5*TempC + 32;

% Tau txais lub sijhawm tam sim no

t = datetime ('tam sim no') - startTime;

% Ntxiv cov ntsiab lus rau cov yeeb yaj kiab

cov ntsiab lus ntxiv (h, datenum (t), TempF)

Hloov tshiab axes

ax. XLim = datenum ([t-seconds (15) t]));

datetick ('x', 'keeplimits')

kos duab

% Txheeb tseg qhov xwm txheej

nres = readDigitalPin (a, 'D12');

Kauj ruam 2: Buzzer

Buzzer
Buzzer

· Hlau hauv lub tswb nrov uas yuav siv los teeb liab nyeem ntawv siab lossis kub heev

· Tsis muaj xov hlau khiav los ntawm kab ntawv zoo mus rau sab zoo ntawm lub suab nrov

· Hloov chaw xaim tau khiav los ntawm qhov zoo ntawm lub suab nrov mus rau qhov chaw nres nkoj sau tias "11"

Qhov no yuav raug siv tom qab txhawm rau hu qhov chaw ntawm lub buzzer hauv cov ntawv sau.

· Code rau buzzer:

yog TempF> = y

disp ('kaw qhov rooj nws kub')

playTone (a, 'D11', 500, 1)

elseif TempF <= x

disp ('kaw qhov rooj nws txias')

playTone (a, 'D11', 250, 1)

kawg

kawg

Kauj Ruam 3: Tus Kws Kho Qhov Muag/Phototransistor

Ntes Ntes/Phototransistor
Ntes Ntes/Phototransistor

· Qhov ntsuas no xav tau cov neeg tawm tsam tsis zoo li lwm tus

· Xyuas kom tseeb tias tag nrho plaub txoj hlua ntawm lub ntsuas tau suav nrog hauv lub voj tom qab ntsaws cov xov hlau

· Lub ntsuas pom pom qhov hloov pauv ntawm lub teeb, sawv cev rau kev txav, thiab sau nws raws li kev nkag

· Txoj Cai rau Kev Tshawb Fawb Txog Qhov Muag/Phototransistor:

meej a

a = arduino ('/dev/tty.usbserial-DN01DVI2', 'Uno', 'Libraries', 'Servo');

sai = 'Teeb lub teeb theem pib'

z = input (tam sim)

LightLevel = 0

thaum lub teebLevel ~ = -1

lightLevel = readVoltage (a, 'A1')

Yog hais tias lightLevel> = z

teb = questdlg ('xav xav hloov AC?', 'Yog', 'Tsis yog')

hloov teb

rooj plaub 'Yog'

answer2 = questdlg ('Tig AC nce lossis nqis?', 'teb', 'Down', 'Up', 'Up')

hloov lus teb 2

rooj 'Down'

s = servo (ib, 'D10');

rau lub kaum ntse ntse = 0:.1:.5

writePosition (s, kaum sab xis);

current_position = readPosition (cov);

current_position = tam sim no qhov chaw * 180;

% luam tawm txoj haujlwm tam sim no ntawm servo motor

fprintf ('Txoj haujlwm tam sim no yog %d / n', qhov chaw tam sim no);

% kev ncua sijhawm me me yog xav tau kom servo tuaj yeem ua haujlwm ntawm

% lub kaum sab xis hais rau nws.

ncua (2);

kawg

% coj rov qab lub cev muaj zog mus rau 0 txoj haujlwm

sauPosition (s, 0);

meej s

prompt = 'Nias ib qho tseem ceeb txuas ntxiv mus'

questdlg ('AC tau tso tseg', 'teb', 'Ok', 'Ok')

rooj 'Up'

s = servo (ib, 'D10');

rau lub kaum ntse ntse =.5:.1: 1

writePosition (s, kaum sab xis);

current_position = readPosition (cov);

current_position = tam sim no qhov chaw * 180;

% luam tawm txoj haujlwm tam sim no ntawm servo motor

fprintf ('Txoj haujlwm tam sim no yog %d / n', qhov chaw tam sim no);

% kev ncua sijhawm me me yog xav tau kom servo tuaj yeem ua haujlwm ntawm

% lub kaum sab xis hais rau nws.

ncua (2);

kawg

Kauj ruam 4: Servo

Servo
Servo

· Cov servo sawv cev

lub tshuab cua txias, thiab yog qhov tso tawm ntawm lub suab ntsuas pom

· Nws yuav tsum muaj cov xaim zoo, xaim av, thiab xaim los ntawm chaw nres nkoj "D9" mus rau servo

· Code rau servo:

% coj rov qab lub cev muaj zog mus rau 0 txoj haujlwm

sauPosition (s, 0);

meej s

prompt = 'Nias ib qho tseem ceeb txuas ntxiv mus'

questdlg ('AC tig', 'teb', 'Ok', 'Ok')

kawg

kawg

ncua

so

kawg

kawg

*Lus ceeb toom tshwj xeeb: qee qhov chaws rau servo tau koom ua ke nrog cov cai rau lub ntsuas qhov muag/phototransistor.

Pom zoo: