Orodha ya maudhui:

Calculator rahisi na ya kawaida na CloudX: Hatua 5
Calculator rahisi na ya kawaida na CloudX: Hatua 5

Video: Calculator rahisi na ya kawaida na CloudX: Hatua 5

Video: Calculator rahisi na ya kawaida na CloudX: Hatua 5
Video: ЗАКРИЧАЛ – ПОТЕРЯЛ ₽200.000 / ТРЭШКЭШ: Тишина 2024, Novemba
Anonim
Calculator rahisi na ya kawaida na CloudX
Calculator rahisi na ya kawaida na CloudX

Katika mafunzo haya, tutajifunza juu ya jinsi ya kutengeneza kikokotoo rahisi na cha kawaida na CloudX, Tafadhali bofya Ikiwa haujasoma chochote kwenye Kitufe cha Kuingiliana na CloudX hapo awali, Hapa, Lengo letu ni kukufundisha jinsi unaweza kukuza kikokotoo cha vifaa mwenyewe kutumia cloudX M633.

Lengo letu ni kuweza kutengeneza kikokotoo ambacho kinaweza kufanya nyongeza (+), kutoa (-), kuzidisha (*) na mgawanyiko (/) na matokeo katika viwango vya chini kama 0.0000001 na kwa idadi nzima hadi 90000000. ana uwezo wa kugundua makosa ya hesabu n.k Kila mtoto, mwanafunzi na hobbyist anapaswa kufanya mradi huu mzuri.

Hatua ya 1: MAHITAJI YA HARDWARE

MAHITAJI YA HABARI
MAHITAJI YA HABARI
MAHITAJI YA HABARI
MAHITAJI YA HABARI

Mdhibiti mdogo wa 1x CloudX

1x CloudX SoftCard

Kebo ya USB ya 1x

Keypad ya Matrix ya 4x4

1x 16x2 waya za Jumper

Mpingaji 1x 1kΩ

4x 10kΩ Resistors

Hatua ya 2: Uunganisho wa PIN

Uunganisho wa siri
Uunganisho wa siri
Uunganisho wa siri
Uunganisho wa siri
Uunganisho wa siri
Uunganisho wa siri

Pini za Uunganisho wa CloudX na pini za Uunganisho za LCD na CloudX na Keypad

Hatua ya 3: Mchoro wa Mzunguko

Mchoro wa Mzunguko
Mchoro wa Mzunguko

Hatua ya 4: SOFTWARE

/ * * Faili: Smart KeyPad Lock System.c

* Mwandishi: hoodie

*

* Iliundwa mnamo Machi 20, 2018, 11: 21 asubuhi

*/

# pamoja

# pamoja

# pamoja

# pamoja

#fafanua NambariOfRows 4 // weka onyesho kwa safu nne

#fafanua NambariOfColumns 4 // weka onyesho kwa safu tatu

char KeypadCharacters [NumberOfRows] [NumberOfColumns] = {

'1', '2', '3', '+', '4', '5', '6', '-', '7', '8', '9', '*', 'C', '0', '=', '/'

};

char RowPins [NumberOfRows] = {7, 8, 9, 10};

char ColumnsPins [NumberOfColumns] = {11, 12, 13, 14};

char Keys, a = 0, angalia = 0, operesheni = 0, signa = 0, ishara = 0;

saini jibu la kuelea;

char * Panswer;

char Aanswer [10];

saini inputa ndefu;

char Ainputa [10];

saini pembejeo ndefub;

char Ainputb [10];

kuanzisha () {

Kuweka vitufe (PULLDOWNCOL, RowPins, ColumnsPins, NumberOfRows, NumberOfColumns, KeypadCharacter);

Kuweka lcd (1, 2, 3, 4, 5, 6);

lcdCmd (lcd_clear);

lcdCmd (mshale_off);

lcdWriteText (1, 1, "CALCULATOR NA");

lcdWriteText (2, 1, "CLOUDX");

kucheleweshaMs (2000);

lcdCmd (lcd_clear);

lcdCmd (mshale_blink);

kitanzi () {

Funguo = GetKey ();

ikiwa (Funguo! = 0 && Funguo == 'C') {

lcdCmd (lcd_clear);

lcdCmd (mshale_blink);

kwa (a = 0; a <10; a ++) {

Ainputa [a] = 0;

Ainputb [a] = 0;

Aanswer [a] = 0;

}

a = 0;

operesheni = 0;

angalia = 0;

signa = 0;

ishara = 0;

}

ikiwa (angalia == 1 && Funguo! = 0 && Funguo == '=') {

lcdCmd (mshale_off);

inputa = atoi (Ainputa);

pembejeo = atoi (Ainputb);

ikiwa (signa == '-') {

inputa = - (inputa);

}

ikiwa (signb == '-') {

pembejeob = - (pembejeob);

}

ikiwa (operesheni == '+') {

jibu = inputa + inputb;

longTostr (Aanswer, jibu, DEC);

}

ikiwa (operesheni == '-') {

jibu = inputa - inputb;

longTostr (Aanswer, jibu, DEC);

}

ikiwa (operesheni == '*') {

jibu = inputa * inputb;

longTostr (Aanswer, jibu, DEC);

}

ikiwa (operesheni == '/') {

jibu = (kuelea) inputa / (kuelea) pembejeob;

Panswer = floatTostr (jibu);

ikiwa (inputa> ingizob) {

Panswer [5] = 0;

}

}

ikiwa (operesheni == '/') {

lcdWriteText (2, 1, "ANS:");

lcdWriteTextCP (Panswer);

}

mwingine {

lcdWriteText (2, 1, "ANS:");

lcdWriteTextCP (Aanswer);

}

}

ikiwa (Funguo! = 0 && (Funguo == '+' || Funguo == '-' || Funguo == '*' || Funguo == '/')

ikiwa (operesheni! = 0 && a == 0 && signb == 0 && (Keys == '-' || Keys == '+')) {

lcdWriteCP (Funguo);

ikiwa (Funguo == '-' || Funguo == '+') {

ishara = Funguo;

}

}

ikiwa (operesheni == 0 && a == 0 && signa == 0 && (Funguo == '-' | Keys == '+')) {

lcdWriteCP (Funguo);

ikiwa (Funguo == '-' || Funguo == '+') {

signa = Funguo;

}

}

ikiwa (operesheni == 0 && a! = 0) {

lcdWriteCP (Funguo);

operesheni = Funguo;

a = 0;

}

}

ikiwa [Funguo! = '5' || Funguo == '6' || Funguo == '7' || Funguo == '8' || Funguo == '9')] {

ikiwa (operesheni! = 0) {

lcdWriteCP (Funguo);

Ainputb [a] = Funguo;

++;

angalia = 1;

}

ikiwa (operesheni == 0) {

lcdWriteCP (Funguo);

Ainputa [a] = Funguo;

++;

}

}

}

}

Hatua ya 5:

Ilipendekeza: