Ukuhlela: Izinhlobo zedatha

I-Arduino IDE, izinhlobo zedatha, ukuhlela

Lapho ufunda ulimi olusha lokuhlela, njengokuthi i-arduino, ungabona njalo ukuthi kukhona okuhlukile izinhlobo zedatha ukumemezela okuguquguqukayo nama-constants okungasingathwa phakathi nohlelo. Lezi zinhlobo zedatha ziyahlukahluka ngobude nohlobo kuye ngolimi noma inkundla (izakhiwo) ohlela kuzo, nakuba ezimweni eziningi ziyefana.

Kulokhu Ukufundisa Uzokwazi ukufunda ukuthi luyini lolu hlobo lwedatha, zingaki, kungani zihluka, njll. Ngale ndlela, uma ubhala ikhodi yomthombo, uzoba nokuqonda kangcono okwenzayo.

Yiziphi izinhlobo zedatha?

Kukhompyutha, izinhlobo zedatha Ziyizici ezibonisa mayelana nesigaba sedatha (inamba engasayiniwe, inombolo esayiniwe, iphoyinti elintantayo, iyunithi yezinhlamvu nezinombolo, amatrices, ...) esiphathwayo. Lokhu futhi kusho imikhawulo ethile noma imikhawulo ngedatha, njengoba kufanele ihloniphe uchungechunge lwamafomu nefomethi. Abakwazi ukuthatha noma yiliphi inani, futhi abakwazi ukuhwebelana ngazo nganoma iyiphi indlela.

Uma singena icala le-ArduinoLeli bhodi lokuthuthukisa alilutho ngaphandle kwekhompyutha encane eshumekiwe, ene-MCU noma i-microcontroller eyakhiwe inkumbulo, i-CPU yokucubungula, kanye nohlelo lwe-I/O. Ku-CPU kunochungechunge lwamayunithi wokubala, njenge-ALU noma iyunithi ye-arithmetic-logical, engenandaba ukuthi iluhlobo luni lwedatha, ngoba kumane kuyindaba yokwenza imisebenzi ngoziro nakwabanye, kodwa side Isoftware inendaba, ngoba kumsebenzisi noma kumhleli kuyadingeka ukwazi ukuthi imayelana nani (ngisho nangokusebenza kahle kohlelo, ukugwema ukuchichima, ubungozi, njll.).

Izinhlobo zedatha ku-Arduino IDE

Arduino UNO imisebenzi yama-millis

Uma usuvele ulandiwe wethu inkambo yokuhlela yamahhala ye-Arduino, noma uma usuvele unolwazi lokuhlela kule nkundla noma yimuphi omunye, usuzokwazi lokho kunezinhlobo ezimbalwa zedatha. Ngokukhethekile, ulimi lokuhlela olusetshenziswa yi-Arduino lusekelwe ku-C ++, ngakho-ke kulowo mqondo lufana kakhulu. Isibonelo, ezivame kakhulu yilezi:

  • i-boolean (8 bit): idatha ye-Boolean, okungukuthi, enengqondo, futhi engathatha inani leqiniso noma elingamanga.
  • i-byte (8 bit): kungaba kusuka ku-00000000 kuya ku-11111111, okungukuthi, ukusuka ku-0 kuye ku-255 ngedesimali.
  • inqola (8-bit): Le byte ingaqukatha izinhlobo ezihlukahlukene zezinhlamvu, njengezinombolo ezisayiniwe phakathi kuka--128 no-+127, kanye nezinhlamvu.
  • inkomba engasayiniwe (8-bit): kuyafana nebhayithi.
  • igama (16-bit): yigama elakhiwe ngamabhayithi angu-2, futhi kungaba inombolo engasayiniwe phakathi kuka-0 no-65535.
  • engasayiniwe (16-bit): inombolo engasayiniwe, efana negama.
  • Int (16-bit) - Inombolo ephelele esayiniwe ukusuka ku--32768 ukuya ku-+32767.
  • okungasayiniwe isikhathi eside (32-bit): isebenzisa amabhayithi amane ngobude obukhulu, ikwazi ukufaka izinombolo phakathi kuka-0 no-4294967295.
  • eside (32-bit): efana neyangaphambili, kodwa ingafaka uphawu, ngakho-ke kungaba phakathi -2147483648 kanye +2147483647.
  • float (32-bit): iyinombolo yephoyinti elintantayo, okungukuthi, inombolo enamadesimali phakathi kuka-3.4028235E38 no-3.4028235E38. Impela isilawuli esincane se-Atmel Atmega328P i-Arduino esekelwe kuso asikusekeli izinombolo zamaphuzu antantayo futhi sinomkhawulo ongu-8-bit ekwakhiweni kwaso. Kodwa-ke, angasetshenziswa ngoba umhlanganisi uyakwazi ukukhiqiza ukulandelana kwekhodi okukwazi ukwenza umsebenzi ofanayo kuphela kusetshenziswa amayunithi ekhompyutha alula we-MCU.

Kungenzeka futhi kube ezinye izinhlobo zedatha okuyinkimbinkimbi kakhulu, njengama-array, izinkomba, iyunithi yezinhlamvu zombhalo, njll.


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Yiba ngowokuqala ukuphawula

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe.

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

Isivivinyo sesiNgisiHlola isiCatalanimibuzo yeSpanishi