Cov txheej txheem:

Ua Neeg Hlau Bumpers (nrog Code): 4 Cov Kauj Ruam
Ua Neeg Hlau Bumpers (nrog Code): 4 Cov Kauj Ruam

Video: Ua Neeg Hlau Bumpers (nrog Code): 4 Cov Kauj Ruam

Video: Ua Neeg Hlau Bumpers (nrog Code): 4 Cov Kauj Ruam
Video: Lub Zog Nruab Nrog (Hmong Dubbed) 2024, Kaum ib hlis
Anonim
Ua Robot Bumpers (nrog Code)
Ua Robot Bumpers (nrog Code)

Cov lus qhia no yuav taug kev nyeem cov ntaub ntawv los ntawm kev tsim thiab cim lub foob pob rau ntawm Boe-bot uas yuav tuaj yeem taug kev los ntawm kev tshawb nrhiav thaum pom cov teeb meem. Kev coding rau txoj haujlwm tau ua tiav siv BASIC Stamp programming software thiab Boe-Bot neeg hlau, thiab kev nkag siab yooj yim ntawm kev siv hluav taws xob thiab cov phiaj xwm xav tau kom ua tiav ntawm kev tsim cov foob pob hluav taws no.

Khoom siv

Txhawm rau tsim cov bumpers no, koj yuav xav tau:

Boe-Bot neeg hlau

- BASIC Stamp programming software

- Popsicle sticks

- Ib daim ntaub

- Aluminium ntawv ci

- Ntawv ntawv

- 8 txoj hlua ntev ncaj ncees (tsawg kawg yog 6 ntiv tes)

-2 LED teeb

-2 xim av-dub-daj-resistors

-2 tus liab-liab-xim av resistors

- Daim kab xev thiab kua nplaum kub (lossis cov nplaum zoo sib xws)

- Roj teeb rau koj Boe-Bot

Kauj Ruam 1: Kauj Ruam 1: Tsim Circuit Court

Kauj Ruam 1: Tsim Circuit Court
Kauj Ruam 1: Tsim Circuit Court
Kauj Ruam 1: Tsim Circuit Court
Kauj Ruam 1: Tsim Circuit Court

Ua raws li daim duab qhia chaw ntawm daim duab qhia chaw saum toj no txhawm rau tsim lub voj voog rau kev taw qhia thiab ua haujlwm ntawm koj lub rooj noj mov. Thaum kawg, koj daim ntawv qhia zaub mov yuav tsum zoo ib yam li daim duab ntawm sab laug.

Yam yuav tsum nco ntsoov:

- Xyuas kom tseeb tias LED nyob hauv txoj haujlwm raug. Qhov no txhais tau tias tiaj tus ceg ntawm LED yuav tsum yog ntawm qhov tsis zoo thiab lwm ceg ntawm qhov zoo.

- Vss ua haujlwm hauv av ntawm daim ntawv qhia no, uas txhais tau tias nws muaj tus nqi xoom, thiab Vdd muaj tus nqi 1.

- Ib qho kev sib tw khiav muaj tus nqi ntawm 0. Lub Circuit Court uas raug kaw muaj tus nqi 1.

Kauj Ruam 2: Kauj Ruam 2: Ua Haujlwm rau Boe-bot

Cov txheej txheem hauv qab no cov neeg hlau tig mus rau sab laug thiab sab xis 90 degrees raws qhov ntawm lub pob tw raug nias (qhia ntxaws ntxiv txog kev tsim lub hauv pliaj hauv cov kauj ruam tom ntej). Txoj cai no ua kom ntseeg tau tias tus neeg hlau yuav tig sab laug thaum lub xov tooj ntawm lub xov tooj ntawm lub xov tooj raug nias, thiab yuav tig sab xis thaum lub xov tooj cua sab laug raug nias.

Qee qhov kev txhais lus yooj yim:

- GOSUB = subroutine (yuav tsum ua raws qhov kev thov hauv txoj cai)

- Yog.. Else = qhia txog pab pawg ntawm cov cai uas yuav tsum tau ua, yog tias cov xwm txheej muaj tseeb, thiab nqa cov lus qhia yog tias cov xwm txheej tsis raug

Cov cai:

'{$ STAMP BS2}

'{$ PBASIC 2.5}' ******************************************* ******************************** 'Reset Restart Code' Siv lub khawm pib dua kom nres thiab pib tus neeg hlau '** ********************************************************** ****** *********************** temp VAR Byte 'cia ib ntus RunStatus DATA $ 00' sib txawv khaws cia hauv ROM Nyeem RunStatus, temp 'Nyeem qhov sib txawv ntawm ROM temp = ~ temp 'hloov pauv tus nqi 0 rau 1 lossis 1 txog 0 WRITE RunStatus, temp' Sau qhov sib txawv rov qab rau ROM YOG (temp> 0) THIAB KAWG 'Txheeb xyuas yog tias tus nqi yog 1' yog li Xaus qhov program PAUSE 3000 'Ncua kom tso cai koj txav 'koj txhais tes thaum koj nias rov pib dua' *************************************** ******************************************** ************** ********************************************************** ****** *********** 'Pins THIAB Constants' Siv los ua kom yooj yim programming '***************************** ********************************************* LMOTOR PIN 15 RMOTOR PIN 14 RFast CON 650 LFast CON 850 RSlow CON 700 LSlow CON 780 MStop CON 750 RFastRev CON 8 50 LFastRev CON 650 RSlowRev CON 800 LSlowRev CON 700 TurnLeft90 CON 90 TurnRight90 CON 90 '************************************** ************************************************ '********* ********************************************************** ****** ************** 'Variables' Siv los ua kom yooj yim programming '**************************** ********************************************* MLoopC VAR Lo Lus 'Rau.. Next Variable mus txog 65000ish sideCount VAR Byte turnAngle VAR Word '************************************ ******************************************** '--------------- ----------------------------------------------------------------------- ------------- 'Txoj Cai Tseem Ceeb' --------------------------------- ----------------------------------------- Ua YOG IN10 = 0 THEN 'Yog tias xaim hauv tus pin 10 yog tom qab tig sab laug GOSUB LeftTurn90 GOSUB LFastRev GOSUB RFastRev ELSEIF IN11 = 0 THIAB 'Yog tias cov xaim hauv tus pin 11 tau qhib ces tig sab xis GOSUB RightTurn90 GOSUB LFastRev GOSUB RFastRev ENDIF GOSUB ForwardFast' txav mus rau tom ntej ib lub plawv dhia LOOP '- --------------------------------- ------------------------------------- '** KAWG NTAWV MAIN CODE ****** ******************************************************** '- ----------------------------------------------------------------------- --------------------- '************************************ **************************************************** ** Sub-routines / Sub-txheej txheem / Txoj hauv kev ******************************** '*********** ********************************************************** ****** *********** '********************************************** ********************************** '****************** ********************************************************** ****** ******* RightTurn90: 'Subprocdure Turn 90deg Right' ************************************** ************************************* HIGH 1 LOW 0 FOR MLoopC = 1 TO 22 PULSOUT LMOTOR, Lfast 'txav mus rau tom ntej ib tus mem tes PULSOUT RMOTOR, RfastRev' siv tus pin thiab txuas PAUSE 20 '20mS tso cai rau neeg hlau txav mus NEXT' ua ntej NEXT pulse RETURN '******************** ********************************************************** ****** * Sab laug tig 90: 'Cov txheej txheem tig 90deg Txoj Cai' ** ********************************************************** ****** ******************* HIGH 0 LOW 1 FOR MLoopC = 1 TO 22 PULSOUT LMOTOR, LfastRev 'txav mus rau tom ntej ib lub mem tes PULSOUT RMOTOR, Rfast' siv tus pin thiab txuas PAUSE 20 ' 20mS tso cai rau neeg hlau txav NEXT 'ua ntej NEXT pulse RETURN' ************************************** ********************************* ForwardFast: 'Cov txheej txheem txav tus neeg hlau mus rau tom ntej ib lub xwmfab nrawm' **** ********************************************************** ****** ***************** Rau MLoopC = 1 txog 55 PULSOUT LMOTOR, LFast PULSOUT RMOTOR, RFast PAUSE 20 NEXT RETURN '************** ********************************************************** ****** ****** ReverseTurnLeft: 'Cov txheej txheem thim rov qab thiab tig lub neeg hlau sab laug thaum txoj cai bumper raug tsoo' *************************** ********************************************************************************************************************************************************** rau MLoopC = 1 txog 55 PULSOUT LMOTOR, LSlowRev PULSOUT RMOTOR, RFastRev PAUSE 20 NEXT RETURN '************************************** ********************************* ReverseTurnRight: 'Subproce dure kom thim rov qab thiab tig tus neeg hlau txoj cai thaum sab laug lub nraub qaum raug tsoo '************************************ ************************************** rau MLoopC = 1 txog 55 PULSOUT LMOTOR, LFastRev PULSOUT RMOTOR, RSlowRev PAUSE 20 NEXT RETURN '********************************************** ************************* 'END OF SUBROUTINES' ******************** ********************************************************** ****** *

Kauj Ruam 3: Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers

Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers
Kauj Ruam 3: Siv Aluminium Ntawv Nyiaj thiab Popsicle Sticks rau Hlau Bumpers

Ua ntej koj pib cov kauj ruam no, xyuas kom tseeb tias 4 xov hlau los ntawm daim ntawv tais (xa mus rau kauj ruam 1) tau muab faib ua ob khub, nrog txhua khub tswj hwm txoj cai lossis sab laug. LEDs ua haujlwm hauv qhov xwm txheej no txhawm rau txheeb xyuas tias txoj cai tau ua haujlwm zoo ntawm txoj cai thiab sab laug. Ntawm Popsicle sticks, ib txoj hlua los ntawm txhua khub sib koom ib qho kawg ntawm Popsicle lo (qhov no txhais tau tias cov xov hlau ntawm tib khub tsis tuaj yeem nyob ntawm tib lub bumper).

Txiav 4 daim duab me me ntawm cov ntawv ci thiab siv ib qho los qhwv cov hlau nyob ib puag ncig txhua qhov kawg ntawm ob qho Popsicle sticks. Qhov no ua rau thaj tsam thaj tsam ntawm kev coj ua ntawm Popsicle lo ntxiv rau muab thaj chaw zoo dua rau cov pas tuav.

Txhawm rau khaws cov ntawv ci thiab cov xov txuas rau Popsicle sticks, siv 1-2 daim ntawv los tuav cov khoom ua ke. Cov ntawv xov xwm tseem muab kev nkag tau yooj yim dua rau Popsicle sticks mus kov yam tsis muaj kev cuam tshuam sab nraud. Xaub daim ntawv xaum hla Popsicle lo ib yam li koj xav nrog cov ntawv ib txwm. Rov ua qhov no rau tag nrho plaub daim ntawv ci thiab txhua qhov kawg ntawm ob lub Popsicle sticks.

Kauj Ruam 4: Kauj Ruam 4: Sib Sau Tag Nrho Cov Pob Tseg

Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb
Kauj Ruam 4: Sib sau Ua Ke Ntawm Lub Pob Zeb

Thaum cov ntawv txhuas thiab daim ntawv tuaj yeem khaws cov xov hlau txuas rau txhua Popsicle lo, txiav ob daim me me ntawm daim txhuam cev thiab kua nplaum txhua lub voos xwmfab ntawm cov pas (ntawm qhov kawg ntawm txhua tus pas kom cov kua nplaum kub tsis cuam tshuam nrog conductivity ntawm cov hlau. Cov sponges ua kom ntseeg tau tias lub pob tw nrog kov txhua lub sijhawm tus neeg hlau tsoo lub phab ntsa.

Yeem tau: Txiav ib qho ntxiv Popsicle lo rau hauv ib nrab thiab lo rau ntawm lub kaum sab xis ntawm qhov kawg ntawm txheej sab nrauv Popsicle lo. Qhov no txhawb ntxiv qhov cuam tshuam ntawm lub bumper tsoo lub phab ntsa thiab tig.

Nco ntsoov khoov cov xov hlau kom cov pob tw nkhaus tawm sab xub ntiag ntawm Bot-bot.

Pom zoo: