Cov txheej txheem:

Cov Khoom Siv Hluav Taws Xob cog kev xav (APEX): 7 Kauj Ruam (nrog Duab)
Cov Khoom Siv Hluav Taws Xob cog kev xav (APEX): 7 Kauj Ruam (nrog Duab)

Video: Cov Khoom Siv Hluav Taws Xob cog kev xav (APEX): 7 Kauj Ruam (nrog Duab)

Video: Cov Khoom Siv Hluav Taws Xob cog kev xav (APEX): 7 Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image

Tab sis tos … Muaj ntau ntxiv!

Kauj ruam 1: Taw qhia

Taw qhia
Taw qhia
Taw qhia
Taw qhia
Taw qhia
Taw qhia

APEX yog dab tsi?

APEX yog lub ntse (tsis hais txog ntxim hlub) cov cuab yeej tshuaj xyuas tsob ntoo. Tsuas yog ntsaws nws rau hauv ib tsob ntoo thiab nws yuav tso saib "kev zoo siab" ntawm cov nroj tsuag! Nov yog qhov ceeb toom zoo rau dej koj cov nroj tsuag yog tias koj muaj tus cwj pwm tsis zoo ntawm kev tsis nco qab ywg dej rau lawv.

Nws ua haujlwm li cas?

Khawv koob. Tso dag xwb! APEX siv Arduino txuas nrog lub ntsuas dej noo, uas tau tso rau hauv cov av ntawm tsob ntoo. Qhov ntsuas no yuav nyeem cov dej noo ntawm cov av, thiab tom qab ntawd Arduino suav lub ntsej muag dab tsi los tso saib.

Tab sis vim li cas?

Vim li cas tsis?

Kauj Ruam 2: Sib Sau Cov Khoom thiab Cov Cuab Yeej

Sib Sau Cov Khoom thiab Cov Cuab Yeej
Sib Sau Cov Khoom thiab Cov Cuab Yeej
Sib Sau Cov Khoom thiab Cov Cuab Yeej
Sib Sau Cov Khoom thiab Cov Cuab Yeej
Sib Sau Cov Khoom thiab Cov Cuab Yeej
Sib Sau Cov Khoom thiab Cov Cuab Yeej

Cia peb nkag mus rau hauv! Txog rau Qhov Qhia Qhia no, koj yuav xav tau ob peb ntu thiab cov cuab yeej. Hmoov zoo rau koj, lawv txhua tus tau teev tseg hauv qab no:

Hauv kev xav ntawm Microcontrollers Contest, txoj haujlwm no tau ua tiav los ntawm cov khoom yuav hauv Amazon! (tsis txhawb nqa)

Daim Ntawv Teev Npe:

  • Arduino Ib
  • 8x8 LED Zaub
  • Capacitive Touch Sensor
  • Hws noo Sensor
  • 9V Roj Teeb Txuas
  • 9V Roj Teeb

Cov Cuab Yeej Sau:

  • 22 Ntsuas Hlau
  • Daim Kab Xev Hluav Taws Xob
  • Hlau Strippers
  • Soldering Hlau
  • Desoldering twj tso kua mis

Thaum koj tau sau tag nrho cov cuab yeej tsim nyog, nws yog lub sijhawm los teeb tsa Arduino software!

Kauj Ruam 3: Txhim Kho Arduino IDE

Txhim kho Arduino IDE
Txhim kho Arduino IDE
Txhim kho Arduino IDE
Txhim kho Arduino IDE
Txhim kho Arduino IDE
Txhim kho Arduino IDE

Txhawm rau txoj haujlwm no ua haujlwm, peb yuav tsum muaj peev xwm ua haujlwm rau Arduino. Qhov no xav tau rub tawm thiab teeb tsa Arduino Integrated Development Environment (IDE) rau hauv koj lub computer. Nws yog qhov piav qhia yooj yim, tab sis kuv yuav taug koj txoj hauv kev:

1. Mus ntsib Arduino Website

2. Mus rau nplooj ntawv rub tawm (Software> Rub Tawm)

3. Nyem qhov Download Link rau koj Cov Txheej Txheem Ua Haujlwm

Nco Ntsoov Sab: Qhov haujlwm yuav ua haujlwm ntawm Windows, Mac, thiab Linux.

4. Txhim Kho Hauv Windows

  • Ob npaug nyem rau ntawm cov ntawv rub tawm los khiav nws
  • Nyem "Pom zoo" kom pom zoo rau Daim Ntawv Tso Cai
  • Ua raws li cov lus qhia tam sim
  • Tam sim no txoj haujlwm yuav tsum tau teeb tsa!

(Nco ntsoov saib cov screenshots yog tias koj poob)

5. Txhim Kho Hauv Mac

  • Nyem rau ntawm cov ntaub ntawv rub tawm
  • Xaiv "Qhib"
  • Qhov program yuav cia li nruab thiab khiav!

(Nco ntsoov xyuas cov screenshots yog tias koj tsis meej pem)

6. Nws yog

Thiab koj ua tiav! Tam sim no koj muaj Arduino IDE rub tawm rau koj lub cev!

Kauj ruam 4: Txoj Cai

Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai
Txoj Cai

Cov kauj ruam no yog txhua yam hais txog cov cai. Nws yog txoj haujlwm luv luv, yog li kuv yuav ua nws nrog koj thiab piav qhia nws ua haujlwm li cas. Ua ntej, piav qhia luv luv, tom qab ntawd piav qhia tob, thiab thaum kawg yuav ua li cas thawb nws mus rau Arduino!

Txoj Kev Nyuaj Siab

Rau cov ntawm koj tsis txaus siab rau cov lus piav qhia ntxaws ntawm cov cai, Kuv tab tom muab TL; DR ntu! Nov yog cov lus piav qhia yooj yim. Arduino tuav qhov tseem ceeb los ntawm lub ntsuas dej noo txhua ob peb feeb. Cov ntaub ntawv no yog tom qab siv los xam thiab tso lub ntsej muag tshwj xeeb! Kuj tseem muaj tus lej me ntsis ntawm qhov kawg uas cia lub khawm muaj peev xwm kov tau qhib thiab tawm ntawm cov zaub. Zoo nkauj yooj yim txoj cai?

Lub Nitty Gritty

Ib feem ntawm qhov kev qhia no yog rau cov uas txaus siab heev tias yuav luag txhua txoj haujlwm ua haujlwm li cas, kab ib kab. Kuv yuav muab cov duab saum toj no los pab koj nkag siab qhov kuv tab tom tham txog, nrog rau suav nrog qee txoj kab ntawm cov lej hauv cov lus piav qhia no.

Txoj haujlwm no tau muab faib ua tsib ntu:

  1. Nrog rau Cov Tsev Qiv Ntawv thiab Tsim Ntau Yam
  2. Teeb Teeb
  3. Kev Ua Haujlwm rau Lub ntsej muag qhia
  4. Kev Sau Arduino Ntawm Matrix Function
  5. Loop Function

Xws li Cov Tsev Qiv Ntawv thiab Tsim Ntau Yam:

Thawj ntu ntawm txoj cai no yog txhua yam hais txog qhov hloov pauv thiab cov tsev qiv ntawv uas peb yuav siv.

#suav nrog "LedControlMS.h"

#define TouchSensor 7 LedControl lc = LedControl (12, 11, 10, 1); int sensorPin = A5; int sensorValue = 0; bool pib = cuav; bool rau = muaj tseeb; boolean nias = LOW;

Thawj kab suav nrog tsev qiv ntawv hu ua LedControlMS. Lub tsev qiv ntawv no xav tau kom tuaj yeem xa qhov muaj txiaj ntsig mus rau LED zaub. Cov kab tom ntej yog cov lus piav qhia uas teev tus pin rau lub kov sensor rau 7. Tom qab ntawd peb muaj peb qhov kev hloov pauv ntau ntxiv uas txhais cov pins rau LED zaub, lub ntsuas dej noo, thiab nws muaj nqis. Peb kab kawg yog txhua tus booleans uas tswj hwm lub xeev ntawm lub khawm kov thiab zaub. Tom qab qhov no, peb muaj peb qhov txiaj ntsig byte:

byte luag ntxhi [4] = {B00000100, B00110010, B01100100, B01100000}; byte xav tsis thoob [4] = {B00001110, B00001010, B01101110, B10010000}; byte meh [4] = {B00000100, B00100100, B00100100, B00100000}; byte tu siab [4] = {B00000010, B01100100, B00110010, B00110000}; byte tuag [6] = {B00001010, B00100100, B00101010, B00100000, B01100000, B01101010}; byte yuam kev [8] = {B00111100, B01000010, B10100001, B10010001, B10001001, B10000101, B01000010, B00111100}; // Lub ntsej muag phem byte esmile [4] = {B00000010, B00101010, B01000100, B01000000}; byte elaugh [4] = {B00000010, B00101010, B01100100, B01100000}; byte eplain [4] = {B00000010, B00101010, B00100100, B00100000}; byte eyell [4] = {B00000001, B01101001, B01100010, B01100000}; byte etalk [4] = {B00000001, B00101001, B01100010, B01100000};

Cov txiaj ntsig no sawv cev rau txhua lub ntsej muag ntawm APEX. Txhua byte yog kab ntawv uas muaj ntau cov khoom uas hais txog lub xeev ntawm txhua lub pixel hauv kab uas tau muab. "1" thiab "0" sawv cev rau On/Off feem.

Teeb Teeb:

Tsiv mus rau ntu tom ntej, peb muaj peb txoj haujlwm teeb tsa.

teeb tsa tsis muaj dab tsi () {// MS Serial Output Serial.begin (9600);

tus pinMode (TouchSensor, INPUT);

// LED Matrix teeb lc.shutdown (0, tsis tseeb); lc.setIntensity (0, 4); lc.clearDisplay (0); }

Lub npe piav qhia nws zoo heev. Nov yog qhov uas peb "teeb tsa" peb lub ntsej muag kov thiab tso saib. Thawj ob kab pib peb cov ntawv tso tawm (siv rau kev debugging). Kab thib peb teeb tsa tus kov sensor tus pin rau lub tswv yim, thiab plaub kab kawg pib pib tso saib.

Kev Ua Haujlwm Rau Lub ntsej muag qhia:

Qhov no yog tej zaum qhov ntev tshaj plaws nyob rau txhua qhov, tab sis nws yog txhua yam yooj yim heev thiab rov ua dua.

void tawg () {lc.setRow (0, 0, yuam kev [0]); lc.setRow (0, 1, yuam kev [1]); lc.setRow (0, 2, yuam kev [2]); lc.setRow (0, 3, yuam kev [3]); lc.setRow (0, 4, yuam kev [4]); lc.setRow (0, 5, yuam kev [5]); lc.setRow (0, 6, yuam kev [6]); lc.setRow (0, 7, yuam kev [7]); }

tsis muaj kev zoo siab () {

lc.setRow (0, 0, luag [0]); lc.setRow (0, 1, luag nyav [1]); lc.setRow (0, 2, luag nyav [2]); lc.setRow (0, 3, luag nyav [3]); lc.setRow (0, 4, luag nyav [3]); lc.setRow (0, 5, luag nyav [2]); lc.setRow (0, 6, luag [1]); lc.setRow (0, 7, luag [0]); }

void tiaj () {

lc.setRow (0, 0, meh [0]); lc.setRow (0, 1, meh [1]); lc.setRow (0, 2, meh [2]); lc.setRow (0, 3, meh [3]); lc.setRow (0, 4, meh [3]); lc.setRow (0, 5, meh [2]); lc.setRow (0, 6, meh [1]); lc.setRow (0, 7, meh [0]); }

tsis muaj dab tsi xav tsis thoob () {

lc.setRow (0, 0, xav tsis thoob [0]); lc.setRow (0, 1, xav tsis thoob [1]); lc.setRow (0, 2, xav tsis thoob [2]); lc.setRow (0, 3, xav tsis thoob [3]); lc.setRow (0, 4, xav tsis thoob [3]); lc.setRow (0, 5, xav tsis thoob [2]); lc.setRow (0, 6, xav tsis thoob [1]); lc.setRow (0, 7, xav tsis thoob [0]); }

void tuag () {

lc.setRow (0, 0, tuag [0]); lc.setRow (0, 1, tuag [1]); lc.setRow (0, 2, tuag [2]); lc.setRow (0, 3, tuag [3]); lc.setRow (0, 4, tuag [4]); lc.setRow (0, 5, tuag [5]); lc.setRow (0, 6, tuag [1]); lc.setRow (0, 7, tuag [0]); }

void quaj () {

lc.setRow (0, 0, tu siab [0]); lc.setRow (0, 1, tu siab [1]); lc.setRow (0, 2, tu siab [2]); lc.setRow (0, 3, tu siab [3]); lc.setRow (0, 4, tu siab [3]); lc.setRow (0, 5, tu siab [2]); lc.setRow (0, 6, tu siab [1]); lc.setRow (0, 7, tu siab [0]); }

tsis muaj qhov phem phem () {

lc.setRow (0, 0, esmile [0]); lc.setRow (0, 1, esmile [1]); lc.setRow (0, 2, esmile [2]); lc.setRow (0, 3, esmile [3]); lc.setRow (0, 4, esmile [3]); lc.setRow (0, 5, esmile [2]); lc.setRow (0, 6, esmile [1]); lc.setRow (0, 7, esmile [0]); }

tsis muaj dab tsi evillaugh () {

lc.setRow (0, 0, luag [0]); lc.setRow (0, 1, luag [1]); lc.setRow (0, 2, luag [2]); lc.setRow (0, 3, luag [3]); lc.setRow (0, 4, luag [3]); lc.setRow (0, 5, luag [2]); lc.setRow (0, 6, luag [1]); lc.setRow (0, 7, luag [0]); }

void evilplain () {

lc.setRow (0, 0, eplain [0]); lc.setRow (0, 1, eplain [1]); lc.setRow (0, 2, eplain [2]); lc.setRow (0, 3, eplain [3]); lc.setRow (0, 4, eplain [3]); lc.setRow (0, 5, eplain [2]); lc.setRow (0, 6, eplain [1]); lc.setRow (0, 7, eplain [0]); }

void evilyell () {

lc.setRow (0, 0, eyell [0]); lc.setRow (0, 1, eyell [1]); lc.setRow (0, 2, eyell [2]); lc.setRow (0, 3, eyell [3]); lc.setRow (0, 4, eyell [3]); lc.setRow (0, 5, eyell [2]); lc.setRow (0, 6, eyell [1]); lc.setRow (0, 7, eyell [0]); }

void eviltalk () {

lc.setRow (0, 0, etalk [0]); lc.setRow (0, 1, etalk [1]); lc.setRow (0, 2, etalk [2]); lc.setRow (0, 3, etalk [3]); lc.setRow (0, 4, etalk [3]); lc.setRow (0, 5, etalk [2]); lc.setRow (0, 6, etalk [1]); lc.setRow (0, 7, etalk [0]); }

Cov haujlwm no tau siv los txheeb xyuas txhua lub ntsej muag uas siv peb qhov txiaj ntsig byte los ntawm thawj ntu. Txhua kab piav qhia txoj haujlwm x thiab byte qhov tseem ceeb thiab tom qab ntawd siv tus nqi rau kab ntawv ntawd. Qee qhov haujlwm xav tau ntau kab vim tias muaj ntau kab siv los tso saib qhov txiaj ntsig ntawm lub ntsej muag ntawd. Txhua lub ntsej muag yog sib npaug, uas yog vim li cas peb rov ua cov kab.

Txoj Haujlwm WriteArduinoOnMatrix:

Ntu plaub yog siv los xam thiab sau lub ntsej muag kom raug ntawm lub teeb LED. Nws suav nrog lwm qhov ntxiv yog cov lus hais uas txheeb xyuas qhov dej thiab tom qab ntawd teeb tsa cov zaub los ntawm kev hu xov tooj sib txawv ntawm ntu dhau los.

void writeArduinoOnMatrix () {yog (sensorValue> 0 && sensorValue 30 && sensorValue 100 && sensorValue 200 && sensorValue 400 && sensorValue 650 && sensorValue <= 800) {ua tsaug (); } lwm {tawg (); }}

Koj tuaj yeem pom tias peb ntxiv "tawg" lub ntsej muag tsuas yog thaum lub sensor mus sab nraud ntawm thaj tsam ua haujlwm. Qhov no tiv thaiv qee qhov txawv txav tsis raug uas tshwm sim thiab muab rau peb kom pom kev nkag siab zoo txog dab tsi tshwm sim hauv txoj cai.

Lub Loop Muaj nuj nqi:

Kawg tab sis tsis tsawg kawg yog lub voj muaj nuj nqi. Txoj cai no ua raws nraim li nws lub npe hais, nws loops! Txawm hais tias muaj ob peb kab hauv txoj haujlwm no, nws yog qhov yooj yim haum. Txoj cai xub nyeem lub xeev khawm thiab pom yog tias cov zaub yog "On". Yog tias nws pom qhov no muaj tseeb, nws yuav hu rau WriteArduinoOnMatrix muaj nuj nqi, uas tom qab ntawd yuav kos lub ntsej muag ntawm APEX. Vim tias qhov haujlwm no loops, nws yuav hloov kho cov duab ntau li peb xav tau. Qhov kev ncua no yog hais los ntawm kev hloov pauv ncua sij hawm.

void loop () {yog (pib == muaj tseeb) {ncua sijhawm = 3000; } // Nyeem khawm nias = digitalRead (TouchSensor);

yog (nias) {

yog (ntawm == muaj tseeb) {lc.clearDisplay (0); ntawm = cuav; ncua (ncua sijhawm); } lwm {on = tseeb; ncua (ncua sijhawm); }} sensorValue = analogRead (sensorPin); ncua (ncua sijhawm); yog (ntawm == muaj tseeb) {// Kos Faces writeArduinoOnMatrix (); }

pib = muaj tseeb;

}

Nov yog txhua yam muaj rau txoj cai. Vam tias tam sim no koj muaj kev nkag siab zoo ntawm nws txhua yam ua haujlwm li cas, thiab tuaj yeem siv qhov kev paub no los pib kho nws rau koj qhov project!

Thawb Txoj Cai rau Arduino

Tam sim no peb tau npog tag nrho cov cai, nws yog lub sijhawm los thawb nws mus rau Arduino! Luckily, IDE ua qhov no yooj yim heev. Txhua yam koj yuav tsum ua yog ntsaws koj Arduino rau hauv koj lub khoos phis tawj nrog USB cable, thiab tom qab ntawd tsuas yog nyem lub xub xub sab xis nyob rau sab saud ntawm IDE. Cia txoj cai thawb, thiab koj yuav tsum pom cov lus ua tiav hauv qab ntawm txoj haujlwm yog tias koj ua nws raug!

Kauj Ruam 5: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court

Ib yam li cov cai, daim duab qhia chaw tsis yooj yim heev. Nws tsuas yog muaj peb lub ntsuas thiab Arduino, yog li kuv yuav qhia koj tus pin-outs rau txhua tus, thiab yog tias koj xav tau lwm yam kev pab, tsuas yog xa mus rau daim duab saum toj no.

LED Zaub:

  • VCC -> 5V
  • GRD -> GRD
  • DIN -> Pin 12
  • CS -> Pin 10
  • CLK -> Pin 11

Hws noo Sensor:

  • Zoo -> 5V
  • Tsis zoo -> GRD
  • Teeb liab -> A5

Capacitive Touch Sensor:

  • VCC -> 5V
  • GRD -> GRD
  • SIB -> 7

Tsis nyuaj heev, txoj cai? Yog tias koj muaj teeb meem nrog tus pin-tawm no, nco ntsoov xa mus rau cov vis dis aus hauv qab no qhov twg kuv taug koj txoj hauv kev los xaim nws li cas.

Kauj Ruam 6: Muab Txhua Qhov Ua Ke

Muab Nws Tag Nrho Ua Ke
Muab Nws Tag Nrho Ua Ke
Muab Nws Tag Nrho Ua Ke
Muab Nws Tag Nrho Ua Ke
Muab Nws Tag Nrho Ua Ke
Muab Nws Tag Nrho Ua Ke

Nws nyuaj rau piav qhia cov ntawv li cas nws haum rau txhua qhov ua ke, yog li kuv yuav twv yuav raug hais qhia txheeb xyuas cov vis dis aus rau ntu no. Kuv tsis tau piav qhia meej tias kuv tso kuv li cas ua ke, nws nyuaj heev. Tab sis txhawm rau piav qhia yam tsis meej, Kuv tau siv cov xov hlau txuas thiab qhwv lawv nyob tom qab ntawm lub rooj tsavxwm. Tom qab ntawd kuv tso lub ntsuas cua thiab siv daim kab xev hluav taws xob los tuav nws txhua qhov ua ke. Thaum kawg, Kuv sim nws nrog lub roj teeb 9V, thiab tom qab ntawd thaum kuv paub nws ua haujlwm, tso lub roj teeb rau sab nraub qaum thiab kaw qhov ntawd ib yam. Ib yam li kuv tau hais ua ntej, Txheeb Tawm Cov VIDEO rau HAUV KAUJ RUAM, nws muaj qhov zoo me me ntu uas tau nrawm thiab yuav pab koj qhwv cov xov hlau kom raug. Tsis txhob ncua nws lossis ua si nws ntawm ib nrab nrawm yog tias koj poob.

Nrog koj zoo siab! Yog tias txhua yam ua tiav, tam sim no koj yuav tsum muaj chav APEX ua haujlwm tau zoo!

Txhawm rau ntsuas koj lub tsev, nrhiav cov nroj tsuag dej thiab ntsaws rau hauv! Koj yuav tsum pom tias nws zoo siab lossis xav tsis thoob thiab qhov no txhais tau tias nws yuav tsum ua haujlwm !!! Ua haujlwm zoo rau kev ua tiav txoj haujlwm!

Kauj Ruam 7: Xaus

Xaus
Xaus

Thiab qhov ntawd yog tag nrho Cov Lus Qhia! Ua tsaug rau kev tshuaj xyuas qhov project! Tawm ib lo lus nug thiab lus pom hauv qab no thiab nco ntsoov ua raws Cov Neeg Ua Liaj Ua Teb Hauv Nroog kom paub ntau yam kev qhia txias zoo li no! Peb yuav nyiam hnov txog tias koj li APEX kev tsim mus li cas, thiab cov duab zoo siab heev! Tsaug dua rau nres, muaj ib hnub zoo!

(Cov Lus Qhia No tau tshoov siab los ntawm txoj haujlwm qub, Tsob Ntoo Emoji!)

PS Cov Lus Qhia No tau nkag mus rau hauv Microcontrollers kev sib tw, yog li tsis txhob hnov qab pov npav rau peb! Peb zoo siab heev nws:)

P. P. S. Nws Cia peb tau APEX hauv Ua Magazine! Pov npav ntawm no! Ua tsaug:)

Pom zoo: