Cov txheej txheem:

Kev Nyuaj Siab Bot 5000: 8 Cov Kauj Ruam
Kev Nyuaj Siab Bot 5000: 8 Cov Kauj Ruam

Video: Kev Nyuaj Siab Bot 5000: 8 Cov Kauj Ruam

Video: Kev Nyuaj Siab Bot 5000: 8 Cov Kauj Ruam
Video: Лучший отель Японии, море, ночной вид, фейерверк, Intercontinental Yokohama 2024, Kaum ib hlis
Anonim
Kev Nyuaj Siab Bot 5000
Kev Nyuaj Siab Bot 5000

Yog tias koj tau los tsev zoo siab me ntsis thiab txaus siab rau koj tus kheej, tom qab ntawv txoj haujlwm no yog rau koj!

Hauv ob peb feeb Kev Nyuaj Siab Bot 5000 yuav xa koj rov qab mus rau qhov kev tu siab ntawm kev tu siab uas peb txhua tus paub thiab hlub.

Hauv Cov Lus Qhia Kuv yuav coj koj rov tsim dua kuv qhov kev tsim, Kev Nyuaj Siab Bot 5000, los ntawm kev siv Arduino ua qhev rau Raspberry Pi kom ci rau koj thaum lub teeb tua. (Wow nyuaj siab thiab ua qhev hauv ib qho kev qhia!?)

Thov sau npe yuav mus rau kuv tus YouTube channel Bolillo Kremer kom pom cov neeg hlau no ua rau kuv lub hnub puas tsuaj thiab rau cov yeeb yaj kiab neeg hlau tsis muaj txiaj ntsig yav tom ntej!

Khoom siv

Tsis yog qhov kev cia siab tias yuav nyuaj siab tua koj? Tom qab ntawd nrawm mus lob cov khoom hauv qab no …

  • Arduino
  • Raspberry Pi
  • Hnub ci vaj huam sib luag lossis LDR Sensor
  • Cov ntaub so ntswg (kom qhuav koj lub kua muag)

Kauj Ruam 1: Saib Dab Tsi Koj Tau Txais Koj Tus Kheej

Image
Image

Saib daim vis dis aus no kom nkag siab zoo txog yam koj yuav ua rau koj tus kheej.

Kauj ruam 2: Circuit Court

Programming Raspberry Pi
Programming Raspberry Pi

Lub Circuit Court rau txoj haujlwm no zoo li zoo dhau los ua qhov tseeb, tab sis nws tsis yog.

Cov lus txhua yam koj yuav tsum tau ua yog ntsaws cov xaim zoo los ntawm koj Hnub Ci Vaj Huam Sib Luag rau hauv A0 ntawm koj Arduino thiab xaim tsis zoo rau hauv GND. Tsis xav tau cov khoom siv ntxiv vim tias lub hnub ci me me muab lub zog me me.

Tsuav lub hnub ci vaj huam sib luag muab tawm tsawg dua 5 volts, peb yuav tsis muaj kev phom sij ntawm kev puas tsuaj rau Arduino.

Kauj Ruam 3: Arduino Code

Image
Image

Hauv Arduino IDE peb yuav tsum ntsuas seb qhov tsaus ntuj tsaus npaum li cas los pib ua rau koj lub neej puas tsuaj los ntawm kev ntsuas qhov hluav taws xob ntawm Hnub Ci Vaj Huam Sib Luag.

Cov vis dis aus saum toj no txiav mus rau qhov twg Arduino Code tab tom ua haujlwm

Txoj cai no luam tawm tus nqi (qhov hluav taws xob)

const ntab RefVolts = 5.0; // 5 volts max

const int SolarPanel = 0; // Analog Pin A0 void teeb () {Serial.begin (9600); } void loop () {int val = analogRead (SolarPanel); ntab volts = (val/ 1023.0)*RefVolts; // Xam volts tawm Serial.println (volts); }

Kuaj nws tawm los ntawm kev tso koj txhais tes hla Solar Panel lossis ci ci rau hauv.

Qhov hluav taws xob yuav tsum nce nrog qhov pom kev.

Thaum koj pom qhov chaw qab zib ntawm qhov uas koj xav kom tus kab mob kev nyuaj siab nqis tes ua, teeb tsa qhov hluav taws xob kom luam tawm qee yam raws kab ntawm "Koj lub hnub tab tom puas lawm".

Hauv kuv qhov piv txwv, yog tias qhov hluav taws xob qis dua.40, nws yuav luam tawm "Ci …"

const ntab RefVolts = 5.0; // 5 volts maxconst int SolarPanel = 0; // Analog Pin A0

void teeb tsa ()

{Serial.begin (9600); }

void lub voj ()

{int val = analogRead (SolarPanel); ntab volts = (val/ 1023.0)*RefVolts; // Xam volts tawm Serial.println (volts);

yog (volts <= 0.40) // Thaum lub teeb tawm {Serial.println ("Ci …");

}

yog tias (volts> 0.40) // Thaum Teeb Pom Kev

{Serial.println ("Sau npe yuav Bolillo Kremer hauv YouTube"); }}

Kauj Ruam 4: Txhim Kho Cov Kev Xav Tau ntawm Raspberry Pi

Kuv thov txim ua ntej rau txhua yam uas koj yuav tsum tau hla dhau hauv cov kauj ruam no.

Hauv koj li Raspberry Pi Terminal ntaus cov cai hauv qab no rau nruab Arduino IDE …

sudo apt -tau nruab arduino -y

Tom qab ntawd teeb tsa nanpy thiab nws cov firmware rau hauv koj cov ntawv rub tawm nrog cov lus txib no …

cd download tau

git-clone

git-clone

Tam sim no mus rau nanpy-firmware los ntawm rub tawm thiab teeb tsa nanpy nrog cov lus txib hauv qab no …

cd nanpy-firmware/ cov

./configure.sh

Los ntawm no, rov qab mus rau Downloads nplaub tshev thiab luam daim nanpy kos duab rau hauv Arduino IDE …

cd ua..

cd ua..

cp -avr nanpy -firmware/~/sketchbook/qiv

Tam sim no los ua nanpy khiav nrog nab hab sej…

cd npi

sudo python3 setup.py nruab

sudo python setup.py nruab

Tom qab ntawd ua daim nplaub tshev ntawm Desktop hu ua nanpy. Tej zaum koj tsis tas yuav ua qhov no los ntawm kev hais kom ua tab sis…

cd ua..

cd ua..

cd Desktop

mkdir nuj

Phew uas yog ntau heev. Txhawm rau ua kom txhua yam ua haujlwm, peb yuav tsum teeb tsa pygame nrog cov lus txib kawg no …

sudo apt-tau nruab python-pygame

Nrog koj zoo siab ua qhov no deb! Txij ntawm no koj yuav tsis txawm xav tau kev nyuaj siab bot los ua rau koj tsis xis nyob.

Tam sim no tsuas yog Upload nanpy kos duab rau koj Arduino siv Arduino IDE ntawm Pi.

(nyob hauv Cov Ntaub Ntawv> Sketchbook> qiv ntawv> nanpy-firmware> Nanpy)

Kauj Ruam 5: Ua Haujlwm Raspberry Pi

Txhua yam ntawm koj txoj haujlwm nyuaj yog yuav them nyiaj!

Tom qab cov txheej txheem nyuaj no ntev, qhov kev nplij siab ntawm kev tu siab tsis muaj tseeb yog qhov koj xav tau, txoj cai?

Sau cov ntawv nab hab sej zoo ib yam li sau c ++ code hauv Arduino IDE …

Hauv tsab ntawv nab nab no peb txuas rau Arduino siv nanpy thiab siv pygame los ua si txhua yam suab uas peb muaj nyob hauv lub voj txuas.

Thaum lub teeb tua, lub suab yuav ua si.

Thaum koj tig lawv rov qab dua lub suab yuav pib qhov uas nws tawm mus.

Nco ntsoov khaws tsab ntawv nab nab hauv nanpy nplaub tshev uas koj tsim ntawm koj lub Desktop.

los ntawm nanpy ntshuam (ArduinoApi, SerialManager) los ntawm lub sijhawm ntshuam ntshuam ntshuam pygame

pygame.init ()

Ci = pygame.mixer.music.load ("Roast.wav")

SolarPanel = 0 RefVolts = 5.0 ua si = Muaj tseeb pygame.mixer.music.play (-1) pygame.mixer.music.pause ()

sim:

kev sib txuas = SerialManager () a = ArduinoApi (kev txuas = txuas) tshwj tsis yog: luam tawm ("Ua tsis tau txuas rau Arduino")

sim:

thaum muaj tseeb: val = a.analogRead (SolarPanel) volts = (val/1023.0)*RefVolts; luam tawm (volts)

yog (volts> = 0.20 thiab ua si == Muaj tseeb):

pygame.mixer.music.pause () print ("Tsis Roasting") print ("Music Paused") playing = False elif (volts> = 0.20 and playing == False): print ("Not Roasting") elif (volts < 0.20 thiab ua si == Muaj tseeb): luam tawm ("Roasting") elif (volts <0.20 thiab ua si == Tsis tseeb): pygame.mixer.music.unpause () print ("Roasting") print ("Music Unpaused") playing = Lwm qhov tseeb: luam tawm ("Yuam Kev")

tshwj tsis yog:

print ("YOOJ YIM")

tshwj tsis yog:

print ("YOOJ YIM")

Kauj Ruam 6: Txhim Kho Koj Lub Neej

Rhuav Koj Lub Neej
Rhuav Koj Lub Neej

Txhawm rau ua kom muaj kev nyuaj siab bot nyob rau nws lub npe, peb yuav tsum tau nug peb cov phooj ywg kom lom zem rau peb.

Kuv pom txoj hauv kev yooj yim peb tuaj yeem ua rau lawv ci rau peb yog los ntawm kev thuam lawv yam tsis muaj cov ntsiab lus.

Tom qab koj muaj qhov tsim nyog hais lus phem (lossis txog thaum koj tsis tuaj yeem siv nws ntxiv lawm) koj yuav xav ntaus lawv rau hauv lub vev xaib no thiab rub tawm lawv ua.mp3

ttsmp3.com/

Tom qab ntawd siv lub vev xaib no los hloov koj lub siab tawg. MP3 rau hauv. WAV siv lub vev xaib no

audio.online-convert.com/convert-to-wav

Thaum kawg, muab qhov ntawd. WAV rau hauv nanpy nplaub tshev nrog rau koj tsab ntawv nab nab.

Kauj Ruam 7: Nqa cov Tissues (Rau Quaj!)

Nqa cov ntaub so ntswg los ntawm koj lub khoos phis tawj lub computer thiab npaj kom los kua muag thaum koj ua haujlwm Kev Nyuaj Siab Bot 5000 los ntawm kev qhib.py cov ntaub ntawv los ntawm IDLE thiab mus rau Run> Run Module

Kauj Ruam 8: Sau npe yuav Bolillo Kremer

Yog tias koj nyiam qhov kev qhia no lossis nyiam kuv qhov kev tsim ntawm Kev Nyuaj Siab Bot 5000, lossis tsuas yog nyiam ib feem ntawm qhov no, thov sau npe mus rau Bolillo Kremer.

Kuv yuav ua cov phiaj xwm neeg hlau lom zem dua sai sai thiab kuv yuav txaus siab rau koj qhov kev txhawb nqa!

Ua tsaug ntau! Kuv mam ntsib koj ntawm cov lus qhia tom ntej;)

Pom zoo: