Cov txheej txheem:
- Kauj Ruam 1: Kauj Ruam 1: Tua Hluav Taws Xob
- Kauj Ruam 2: Kauj Ruam 2: Sau Txoj Cai
- Kauj Ruam 3: Kauj Ruam 3: Yuav Lub Teeb
- Kauj Ruam 4: Kauj Ruam 4: Rub Nws Txhua Qhov Ua Ke
- Kauj Ruam 5: Kauj Ruam 5: Ua Daim Npav Ua Si
Video: Kev Sib Tw tiag tiag: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Lub ntiaj teb niaj hnub xav kom tib neeg tawm ntawm lub cev thiab nyob hauv digital.
Nrog rau qhov pom ntawm Al thiab kev nthuav dav ntawm cov neeg siv thev naus laus zis tso siab rau hauv lub tshuab ntau dhau thiab ntseeg nws ib txwm yog qhov raug.
"Tiag tiag" yog lub hom phiaj txhawm rau txhawm rau qhov kev ntseeg cuav no los ntawm kev tsim cov cuav cuav kuaj ntsuas. Tib neeg yuav yooj yim ntseeg tias tiag tiag tab tom ua haujlwm tab sis thaum muab cov lus teb tsis raug nws yuav ua rau lawv qhov muag tsis pom kev ntseeg hauv thev naus laus zis.
Kauj Ruam 1: Kauj Ruam 1: Tua Hluav Taws Xob
Vim tias kuv txoj haujlwm tsuas muaj ib lub teeb xwb, yog li nws yooj yim heev rau cov laug. Qhov teeb meem tseem ceeb yog thaum pib, Kuv tau siv ob lub teeb, tab sis kuv tsis tau npog qhov raug tam sim ntawd. Yog li thaum ob lub xov hlau txuas ua ke. Nws luv luv.
Kauj Ruam 2: Kauj Ruam 2: Sau Txoj Cai
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; kab-qhov siab: 15.0px; font: 12.0px Lub Sijhawm; xim: #000000; xim tom qab: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; kab-qhov siab: 15.0px; font: 12.0px Lub Sijhawm; xim: #000000; xim tom qab: #ffffff; min-height: 14.0px} span.s1 {font-kerning: tsis muaj}
Kauj Ruam 2: Sau Txoj Cai
/*********************************************************************
Nov yog qhov piv txwv rau peb nRF52 raws Bluefruit LE modules
Xaiv ib qho hnub no hauv khw adafruit!
Adafruit nqis peev sijhawm thiab peev txheej muab qhov qhib qhov chaws no, thov txhawb nqa Adafruit thiab qhib qhov khoom kho vajtse los ntawm kev yuav khoom
khoom los ntawm Adafruit!
MIT daim ntawv tso cai, txheeb xyuas LICENSE kom paub ntau ntxiv
Txhua cov ntawv sau saum toj no, thiab lub vijtsam txaws hauv qab no yuav tsum suav nrog
ib qho kev faib tawm tshiab
*********************************************************************
/ Cov duab no yog npaj los siv nrog NeoPixel tswj
// nto hauv Adafruit's Bluefruit LE Txuas daim ntawv thov mobile.
/
/ - Sau thiab nyem qhov kos duab no rau nRF52 Plaub
// - Qhib Bluefruit LE Txuas app
// - Hloov mus rau NeoPixel cov khoom siv hluav taws xob
// - Nyem rau 'txuas' khawm txhawm rau tsim kev sib txuas thiab
// xa cov ntaub ntawv meta txog pixel txheej txheem
// - Siv NeoPixel cov khoom siv los hloov kho cov pixels ntawm koj lub cuab yeej
/* NCO TSEG: Qhov kos duab no xav tau tsawg kawg version 1.1.0 ntawm Adafruit_Neopixel !!! */
#suav nrog
#suav nrog
#suav nrog
#define NEOPIXEL_VERSION_STRING "Neopixel v2.0"
#define PIN 16 / * Tus Pin siv los tsav NeoPixels * /
#define MAXCOMPONENTS 4
uint8_t *pixelBuffer = NULL;
uint8_t dav = 0;
uint8_t qhov siab = 0;
uint8_t taug kev;
uint8_t CheebtsamValue;
bool yog 400Hz;
uint8_t Cheebtsam = 3; // tsuas yog 3 thiab 4 yog qhov tseem ceeb siv tau
Adafruit_NeoPixel neopixel = Adafruit_NeoPixel ();
// Kev Pabcuam BLE
BLEDfu bledfu;
BLEDis bledis;
BLEUart bleuart;
void teeb tsa ()
{
Serial.begin (115200);
thaum (! Serial) ncua (10); // rau nrf52840 nrog haiv neeg usb
Serial.println ("Adafruit Bluefruit Neopixel Test");
Serial.println ("--------------------------------");
Serial.println ();
Serial.println ("Thov txuas nrog siv Bluefruit Txuas LE daim ntawv thov");
// Config Neopixels
neopixel.begin ();
// Thawj Bluefruit
Bluefruit.begin ();
Bluefruit.setTxPower (4); // Txheeb xyuas bluefruit.h rau qhov muaj txiaj ntsig txhawb
Bluefruit.setName ("Bluefruit52");
Bluefruit. Periph.setConnectCallback (txuas_callback);
// Yuav kom zoo ib yam OTA DFU yuav tsum tau ntxiv ua ntej yog tias nws muaj
bledfu.begin ();
// Kho thiab Pib Pabcuam Cov Ntaub Ntawv Qhia
bledis.setManufacturer ("Adafruit Industries");
bledis.setModel ("Bluefruit Feather52");
bledis.begin ();
// Kho thiab pib BLE UART kev pabcuam
bleuart.begin ();
// Teeb tsa thiab pib tshaj tawm
pib Adv ();
}
void startAdv (tsis muaj dab tsi)
{
// Pob ntawv tshaj tawm
Bluefruit. Advertising.addFlags (BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit. Advertising.addTxPower ();
// Xws li bleuart 128-ntsis uuid
Bluefruit. Advertising.addService (bleuart);
// Secondary Scan Response Packet (yeem)
// Vim tias tsis muaj chaw rau 'Lub Npe' hauv Cov Ntawv Tshaj Tawm
Bluefruit. ScanResponse.addName ();
/* Pib Tshaj Tawm
* - Pab kom pib tshaj tawm yog tias muaj kev sib txuas
* - Lub sijhawm luv: hom nrawm = 20 ms, hom qeeb = 152.5 ms
* - Lub sijhawm siv rau hom nrawm yog 30 vib nas this
* - Pib (ncua sijhawm) nrog sijhawm = 0 yuav tshaj tawm mus ib txhis (kom txog thaum txuas nrog)
*
* Rau kev pom zoo ncua sijhawm tshaj tawm
*
*/
Bluefruit. Advertising.restartOnDisconnect (muaj tseeb);
Bluefruit. Advertising.setInterval (32, 244); // hauv chav ntawm 0.625 ms
Bluefruit. Advertising.setFastTimeout (30); // tus naj npawb ntawm vib nas this hauv hom nrawm
Bluefruit. Advertising.start (0); // 0 = Tsis txhob tso kev tshaj tawm tom qab n vib nas this
}
void connect_callback (uint16_t conn_handle)
{
// Tau txais kev siv rau kev txuas tam sim no
BLEConnection* txuas = Bluefruit. Connection (conn_handle);
char central_name [32] = {0};
connection-> getPeerName (central_name, sizeof (central_name));
Serial.print ("Txuas nrog");
Serial.println (central_name);
Serial.println ("Thov xaiv 'Neopixels' tab, nyem 'Txuas' thiab muaj kev lom zem");
}
void lub voj ()
{
// Echo tau txais cov ntaub ntawv
yog (Bluefruit.connected () && bleuart.notifyEnabled ())
{
int hais kom ua = bleuart.read ();
hloov (hais kom ua) {
rooj plaub 'V': {// Tau txais Version
commandVersion ();
tawg;
}
rooj plaub 'S': {// Teeb qhov ntev, cov khoom siv, txav mus los …
commandSetup ();
tawg;
}
rooj plaub 'C': {// Ntshiab nrog xim
commandClearColor ();
tawg;
}
rooj plaub 'B': {// Teeb Brightness
commandSetBrightness ();
tawg;
}
rooj plaub 'P': {// Teeb Pixel
commandSetPixel ();
tawg;
}
rooj plaub 'Kuv': {// Tau txais cov duab tshiab
commandImage ();
tawg;
}
}
}
}
tsis muaj dab tsi swapBuffers ()
{
uint8_t *base_addr = pixelBuffer;
int pixelIndex = 0;
rau (int j = 0; j <qhov siab; j ++)
{
rau (int i = 0; kuv <width; i ++) {
yog (Cheebtsam == 3) {
neopixel.setPixelColor (pixelIndex, neopixel. Color (*base_addr, *(base_addr+1), *(base_addr+2)));
}
lwm tus {
neopixel.setPixelColor (pixelIndex, neopixel. Color (*base_addr, *(base_addr+1), *(base_addr+2), *(base_addr+3)));
}
base_addr+= cov khoom;
pixelIndex ++;
}
pixelIndex += stride - dav; // Tsiv pixelIndex mus rau kab tom ntej (coj mus rau hauv tus account qhov kev nqis tes ua)
}
neopixel.show ();
}
void commandVersion () {
Serial.println (F ("Command: Version check"));
sendResponse (NEOPIXEL_VERSION_STRING);
}
void commandSetup () {
Serial.println (F ("Command: Setup"));
dav = bleuart.read ();
qhov siab = bleuart.read ();
txav mus = bleuart.read ();
CheebtsamValue = bleuart.read ();
yog 400Hz = bleuart.read ();
neoPixelType pixelType;
pixelType = componentsValue + (is400Hz? NEO_KHZ400: NEO_KHZ800);
components = (componentsValue == NEO_RGB || componentsValue == NEO_RBG || componentsValue == NEO_GRB || componentsValue == NEO_GBR || componentsValue == NEO_BRG || componentsValue == NEO_BGR)? 3: 4;
Serial.printf ("\ tsize: %dx %d / n", dav, qhov siab);
Serial.printf ("\ tstride: %d / n", txav mus);
Serial.printf ("\ tpixelType %d / n", pixelType);
Serial.printf ("\ tcomponents: %d / n", Cheebtsam);
yog (pixelBuffer! = NULL) {
rho tawm pixelBuffer;
}
uint32_t loj = dav*qhov siab;
pixelBuffer = tshiab uint8_t [qhov loj me*Cheebtsam];
neopixel.updateLength (loj);
neopixel.updateType (pixelType);
neopixel.setPin (PIN);
// Ua tau
sendResponse ("OK");
}
void commandSetBrightness () {
Serial.println (F ("Command: SetBrightness"));
// Nyeem tus nqi
uint8_t ci ntsa iab = bleuart.read ();
// Teeb ci ntsa iab
neopixel.setBrightness (ci ntsa iab);
// Refresh pixels
swapBuffers ();
// Ua tau
sendResponse ("OK");
}
void commandClearColor () {
Serial.println (F ("Command: ClearColor"));
// Nyeem xim
uint8_t xim [MAXCOMPONENTS];
rau (int j = 0; j <components;) {
yog (bleuart.available ()) {
xim [j] = bleuart.read ();
j ++;
}
}
// Teeb tag nrho cov leds rau xim
int loj = dav * qhov siab;
uint8_t *base_addr = pixelBuffer;
rau (int kuv = 0; kuv <loj; kuv ++) {
rau (int j = 0; j <components; j ++) {
*base_addr = xim [j];
base_addr ++;
}
}
// Hloov pauv
Serial.println (F ("ClearColor ua tiav"));
swapBuffers ();
yog (Cheebtsam == 3) {
Serial.printf ("\ tclear (%d, %d, %d) n", xim [0], xim [1], xim [2]);
}
lwm tus {
Serial.printf ("\ tclear (%d, %d, %d, %d) n", xim [0], xim [1], xim [2], xim [3]);
}
// Ua tau
sendResponse ("OK");
}
void commandSetPixel () {
Serial.println (F ("Command: SetPixel"));
// Nyeem txoj haujlwm
uint8_t x = bleuart.read ();
uint8_t y = bleuart.read ();
// Nyeem xim
uint32_t pixelOffset = y*dav+x;
uint32_t pixelDataOffset = pixelOffset*Cheebtsam;
uint8_t *base_addr = pixelBuffer+pixelDataOffset;
rau (int j = 0; j <components;) {
yog (bleuart.available ()) {
*base_addr = bleuart.read ();
base_addr ++;
j ++;
}
}
// Teeb xim
uint32_t neopixelIndex = y*stride+x;
uint8_t *pixelBufferPointer = pixelBuffer + pixelDataOffset;
uint32_t xim;
yog (Cheebtsam == 3) {
xim = neopixel. Color (*pixelBufferPointer, *(pixelBufferPointer+1), *(pixelBufferPointer+2));
Serial.printf ("\ tcolor (%d, %d, %d) n", *pixelBufferPointer, *(pixelBufferPointer+1), *(pixelBufferPointer+2));
}
lwm tus {
xim = neopixel. Color (*pixelBufferPointer, *(pixelBufferPointer+1), *(pixelBufferPointer+2), *(pixelBufferPointer+3));
Serial.printf ("\ tcolor (%d, %d, %d, %d) n", *pixelBufferPointer, *(pixelBufferPointer+1), *(pixelBufferPointer+2), *(pixelBufferPointer+3));
}
neopixel.setPixelColor (neopixelIndex, xim);
neopixel.show ();
// Ua tau
sendResponse ("OK");
}
void commandImage () {
Serial.printf ("Hais kom ua: Duab %dx %d, %d, %d / n", qhov dav, qhov siab, cov khoom siv, txav mus los);
// Tau txais pixel tshiab tsis
int loj = dav * qhov siab;
uint8_t *base_addr = pixelBuffer;
rau (int kuv = 0; kuv <loj; kuv ++) {
rau (int j = 0; j <components;) {
yog (bleuart.available ()) {
*base_addr = bleuart.read ();
base_addr ++;
j ++;
}
}
/*
yog (Cheebtsam == 3) {
uint32_t index = i*cov khoom;
Serial.printf ("\ tp %d (%d, %d, %d) n", i, pixelBuffer [index], pixelBuffer [index+1], pixelBuffer [index+2]);
}
*/
}
// Hloov pauv
Serial.println (F ("Duab tau txais"));
swapBuffers ();
// Ua tau
sendResponse ("OK");
}
void sendResponse (char const *teb) {
Serial.printf ("Xa Cov Lus Teb: %s / n", teb);
bleuart.write (teb, strlen (teb)*sizeof (char));
}
Kauj Ruam 3: Kauj Ruam 3: Yuav Lub Teeb
Kauj Ruam 4: Kauj Ruam 4: Rub Nws Txhua Qhov Ua Ke
Pom zoo:
Kev muaj tiag tiag ntawm Raspberry Pi Nrog BeYourHero !: 19 Kauj Ruam (nrog Duab)
Kev muaj tiag tiag ntawm Raspberry Pi Nrog BeYourHero!: Txais tos rau "Ua Koj Tus Hero" Kuv vam tias koj npaj txhij nkag mus rau lwm tiam ntawm Virtual Reality raus dej! Txoj haujlwm no yuav muab rau koj tag nrho kev piav tes piav taw tswj ntawm txhua tus phab ej virtual uas koj nyiam nrog cov txheej txheem yooj yim ntawm cov cuab yeej pheej yig siv se
Lub Sijhawm Tiag Tiag Tiag Tiag Tiag Paub Siv EM Hneev Taw: 6 Kauj Ruam
Kev Pom Zoo Lub Sijhawm Tiag Tiag Siv EM Cov Hneev Taw: Cov cuab yeej no yog txhawm rau faib cov khoom siv hluav taws xob sib txawv raws li lawv cov cim EM. Rau cov cuab yeej sib txawv, lawv muaj cov cim sib txawv EM tawm los ntawm nws. Peb tau tsim kev daws teeb meem IoT txhawm rau txheeb xyuas cov khoom siv hluav taws xob siv Particle
Lub kaus mom tsis yog lub kaus mom - Cov kaus mom rau cov neeg uas tsis tau hnav lub kaus mom tiag tiag, tab sis xav tau lub kaus mom kev paub: 8 Kauj Ruam
Lub kaus mom tsis yog lub kaus mom rau cov tib neeg uas tsis tau hnav lub kaus mom tiag tiag, tab sis xav tau lub kaus mom kev paub: Kuv ib txwm xav tias kuv tuaj yeem yog tus neeg lub kaus mom, tab sis tsis tau pom dua lub kaus mom uas ua haujlwm rau kuv. Qhov no "Hat Not Hat," lossis fascinator raws li nws tau hu ua yog txheej txheej sab saum toj rau kuv cov teeb meem lub kaus mom uas kuv tuaj yeem koom nrog Kentucky Derby, vacu
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: 4 Cov Kauj Ruam
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: Nyeem … lub npe