Girouette numérique de 8 bits (4 / 5 étapes)

Étape 4: Programmation du Nano

Le noir 35 mm tuyau d’eau usée contient un Arduino Nano qui est programmé pour lire les données de l’encodeur rotatif Bourns et la comparer à une table de vérité pour donner la direction du vent réel en coordonnées polaires (degrés).

Chaque « peu » de données est lue indépendamment et compilées dans un « collier » de segments de données 8 longs. À ce stade, il ressemble par exemple à une charge de zéros et d’uns. 00100110.

Cette chaîne est ensuite convertie en un entier.

L’entier produit est comparativement à 128 autres entiers dans une table de vérité, de voir ce que le capteur est effectivement pointant à la direction.

Au cours d’une dizaine de minutes, lectures de l’encodeur rotatif sont prises à 0,5 seconde d’intervalle et un calcul est effectué pour trouver celui qui est l’un plus courant. Il n’est pas acceptable de prendre juste une lecture comme la direction du vent n’est jamais réellement constante à moins que la vitesse du vent est trop faible pour bouger le capteur. Une dernière lecture de 248 degrés, par exemple, est extrapolée à partir une grande matrice de nombres environ 1200 !

L’entier de la mode final est ensuite converti en sa propre fréquence distincte à l’aide de l’Arduino « Tone » fonctionne et fait descendre le câble à 4 conducteurs, via une résistance de 10K, comme une impulsion très courte onde carrée toutes les 0,5 secondes. Nous pourrions envoyer un signal continu, mais ce serait un gaspillage d’énergie électrique précieux.

Enfin, il y a une épingle sur le Nano dédié à recevoir un appel de retour du signal du processeur principal station météo pour réinitialiser toutes les valeurs et commencer à assembler une valeur Neuve de la direction du vent mode.

 <p>int p=0;<br> unsigned long n=0; int answerAA =0; int answerAB; // Change this to an int for debugging. int count=0; int resetNanoStatus; const int ledPin = 13; // the pin that the LED is attached to int callBackFromMaster = 11; // Tone output on pin 10. int val1 =0; int resetStatus = LOW; int aa=0; int ab=0; int ac=0; int ad=0; int ae=0; int af=0; int ag=0; int ah=0; int ai=0; int aj=0; int ak=0; int al=0; int am=0; int ba=0; int bb=0; int bc=0; int bd=0; int be=0; int bf=0; int bg=0; int bh=0; int bi=0; int bj=0; int bk=0; int bl=0; int ca=0; int cb=0; int cc=0; int cd=0; int ce=0; int cf=0; int cg=0; int ch=0; int ci=0; int cj=0; int ck=0; int cl=0; int ea=0; int eb=0; int ec=0; int ed=0; int ee=0; int ef=0; int eg=0; int eh=0; int ei=0; int ej=0; int ek=0; int el=0; int fa=0; int fb=0; int fc=0; int fd=0; int fe=0; int ff=0; int fg=0; int fh=0; int fi=0; int fj=0; int fk=0; int fl=0; int ga=0; int gb=0; int gc=0; int gd=0; int ge=0; int gf=0; int gg=0; int gh=0; int gi=0; int gj=0; int gk=0; int gl=0; int ha=0; int hb=0; int hc=0; int hd=0; int he=0; int hf=0; int hg=0; int hh=0; int hi=0; int hj=0; int hk=0; int hl=0; int ia=0; int ib=0; int ic=0; int id=0; int ie=0; int iff=0; int ig=0; int ih=0; int ii=0; int ij=0; int ik=0; int il=0; int ja=0; int jb=0; int jc=0; int jd=0; int je=0; int jf=0; int jg=0; int jh=0; int ji=0; int jj=0; int jk=0; int jl=0; int ka=0; int kb=0; int kc=0; int kd=0; int ke=0; int kf=0; int kg=0; int kh=0; int ki=0; int kj=0; int kk=0; int kl=0; int la=0; int lb=0; int lc=0; int ld=0; int le=0; int lf=0; int lg=0; int lh=0; int li=0; int lj=0; int lk=0; int ll=0; int lm=0; void setup() { pinMode(ledPin, OUTPUT); //start serial connection Serial.begin(115200); pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); pinMode(4, INPUT_PULLUP); pinMode(5, INPUT_PULLUP); pinMode(6, INPUT_PULLUP); pinMode(7, INPUT_PULLUP); pinMode(8, INPUT_PULLUP); pinMode(9, INPUT_PULLUP); // tone is on pin 10 pinMode(11, INPUT_PULLUP); // Call back from Master. pinMode(13, OUTPUT); String d; } void loop() { resetValues(); tone (10,100+50*answerAB,50); count =count+1; int columnOne = digitalRead(9); int columnTwo = digitalRead(2); int columnThree = digitalRead(3); int columnFour = digitalRead(4); int columnFive = digitalRead(5); int columnSix = digitalRead(6); int columnSeven = digitalRead(7); int columnEight = digitalRead(8); // Serial.print("Integers = "); // Serial.print(columnOne); // Serial.print(columnTwo); // Serial.print(columnThree); // Serial.print(columnFour); // Serial.print(columnFive); // Serial.print(columnSix); // Serial.print(columnSeven); // Serial.println(columnEight); // Serial.print("n = ");Serial.println(n); String d = String(columnOne)+String(columnTwo)+String(columnThree)+String(columnFour)+String(columnFive)+String(columnSix)+String(columnSeven)+String(columnEight); // Serial.print("data in string format = ");Serial.println(d); // Serial.print("count = ");Serial.println(count); n = d.toInt(); if (n==10011000){p=6;} if (n==10011111){p=17;} if (n==10000111){p=29;} if (n==10010111){p=30;} if (n==10001111){p=34;} if (n==10001110){p=35;} if (n==10000011){p=68;} if (n==10001011){p=69;} if (n==10001001){p=70;} if (n==10000001){p=71;} if (n==10000000){p=72;} if (n==10000100){p=73;} if (n==10010100){p=74;} if (n==10010000){p=121;} if (n==10010010){p=122;} if (n==10011010){p=123;} if (n==10011110){p=124;} if (n==10111000){p=5;} if (n==10101111){p=15;} if (n==10111111){p=16;} if (n==10100100){p=26;} if (n==10100110){p=27;} if (n==10100111){p=28;} if (n==10101001){p=59;} if (n==10100011){p=67;} if (n==10111100){p=110;} if (n==10111110){p=111;} /////////////////////////////////////////// if (n==11111110){p=112;} if (n==11010100){p=75;} if (n==11110100){p=76;} if (n==11110000){p=77;} if (n==11110010){p=78;} if (n==11111010){p=79;} if (n==11111011){p=80;} if (n==11111001){p=81;} if (n==11110001){p=82;} if (n==11010001){p=83;} if (n==11000001){p=84;} if (n==11000101){p=85;} if (n==11000100){p=86;} if (n==11000000){p=87;} if (n==11111101){p=96;} if (n==11111100){p=97;} if (n==11111000){p=98;} if (n==11101000){p=99;} if (n==11100000){p=100;} if (n==11100010){p=101;} if (n==11101001){p=60;} if (n==11100001){p=61;} if (n==11100101){p=62;} if (n==11110101){p=63;} if (n==11110111){p=64;} if (n==11110011){p=65;} if (n==11100011){p=66;} if (n==11010011){p=44;} if (n==11000011){p=45;} if (n==11001011){p=46;} if (n==11101011){p=47;} if (n==11101111){p=48;} if (n==11100111){p=49;} if (n==11000111){p=50;} if (n==11010111){p=31;} if (n==11011111){p=32;} if (n==11001111){p=33;} ///////////////////////////////////////// if (n==111111){p=1;} if (n==111110){p=2;} if (n==111010){p=3;} if (n==111000){p=4;} if (n==11000){p=7;} if (n==1000){p=8;} if (n==1111){p=13;} if (n==101111){p=14;} if (n==11111){p=18;} if (n==11101){p=19;} if (n==11100){p=20;} if (n==1100){p=23;} if (n==100){p=24;} if (n==100100){p=25;} if (n==1110){p=36;} if (n==101110){p=37;} if (n==100110){p=38;} if (n==110){p=39;} if (n==10){p=40;} if (n==10010){p=41;} if (n==111){p=52;} if (n==10111){p=53;} if (n==10011){p=54;} if (n==11){p=55;} if (n==1){p=56;} if (n==1001){p=57;} if (n==101001){p=58;} if (n==100000){p=104;} if (n==100001){p=105;} if (n==100101){p=106;} if (n==110101){p=107;} if (n==111101){p=108;} if (n==111100){p=109;} if (n==110001){p=118;} if (n==110000){p=119;} if (n==10000){p=120;} if (n==11110){p=125;} //////////////////////////////////////// if (n==1001000){p=9;} if (n==1001001){p=10;} if (n==1001101){p=11;} if (n==1001111){p=12;} if (n==1111111){p=0;} if (n==1011100){p=21;} if (n==1001100){p=22;} if (n==1010010){p=42;} if (n==1010011){p=43;} // Take the front 0 off. if (n==1000111){p=51;} if (n==1000000){p=88;} if (n==1000010){p=89;} if (n==1001010){p=90;} if (n==1101010){p=91;} if (n==1111010){p=92;} if (n==1111000){p=93;} if (n==1111001){p=94;} if (n==1111101){p=95;} if (n==1100010){p=102;} if (n==1100000){p=103;} if (n==1111110){p=113;} if (n==1111100){p=114;} if (n==1110100){p=115;} if (n==1110000){p=116;} if (n==1110001){p=117;} if (n==1011110){p=126;} if (n==1011111){p=127;} </p><p>// Group A: if (p==0){aa=aa+1;} if (p==1){ab=ab+1;} if (p==2){ac=ac+1;} if (p==3){ad=ad+1;} if (p==4){ae=ae+1;} if (p==5){af=af+1;} if (p==6){ag=ag+1;} if ((aa>ab)&&(aa>ac)&&(aa>ad)&&(aa>ae)&&(aa>ag)&&(aa>af)&&(aa>answerAA)){answerAA=aa;answerAB=0;} if ((ab>ag)&&(ab>ac)&&(ab>ad)&&(ab>ae)&&(ab>af)&&(ab>ag)&&(ab>answerAA)){answerAA=ab;answerAB=1;} if ((ac>ag)&&(ac>ab)&&(ac>ad)&&(ac>ae)&&(ac>af)&&(ac>ag)&&(ac>answerAA)){answerAA=ac;answerAB=2;} if ((ad>ag)&&(ad>ab)&&(ad>ac)&&(ad>ae)&&(ad>af)&&(ad>ag)&&(ad>answerAA)){answerAA=ad;answerAB=3;} if ((ae>ag)&&(ae>ab)&&(ae>ac)&&(ae>ad)&&(ae>af)&&(ae>ag)&&(ae>answerAA)){answerAA=ae;answerAB=4;} if ((af>ag)&&(af>ab)&&(af>ac)&&(af>ad)&&(af>ae)&&(af>ag)&&(af>answerAA)){answerAA=af;answerAB=5;} if ((ag>aa)&&(ag>ab)&&(ag>ac)&&(ag>ad)&&(ag>ae)&&(ag>af)&&(ag>answerAA)){answerAA=ag;answerAB=6;} // Group B: if (p==7){ah=ah+1;} if (p==8){ai=ai+1;} if (p==9){aj=aj+1;} if (p==10){ak=ak+1;} if (p==11){al=al+1;} if (p==12){am=am+1;} if ((ah>am)&&(ah>ai)&&(ah>aj)&&(ah>ak)&&(ah>al)&&(ah>answerAA)){answerAA=ah;answerAB=7;} if ((ai>am)&&(ai>ah)&&(ai>aj)&&(ai>ak)&&(ai>al)&&(ai>answerAA)){answerAA=ai;answerAB=8;} if ((aj>am)&&(aj>ah)&&(aj>ai)&&(aj>ak)&&(aj>al)&&(aj>answerAA)){answerAA=aj;answerAB=9;} if ((ak>am)&&(ak>ah)&&(ak>ai)&&(ak>aj)&&(ak>al)&&(ak>answerAA)){answerAA=ak;answerAB=10;} if ((al>am)&&(al>ah)&&(al>ai)&&(al>aj)&&(al>ak)&&(al>answerAA)){answerAA=al;answerAB=11;} if ((am>al)&&(am>ah)&&(am>ai)&&(am>aj)&&(am>ak)&&(am>answerAA)){answerAA=am;answerAB=12;} // Group C: if (p==13){ba=ba+1;} if (p==14){bb=bb+1;} if (p==15){bc=bc+1;} if (p==16){bd=bd+1;} if (p==17){be=be+1;} if (p==18){bf=bf+1;} if ((ba>bb)&&(ba>bc)&&(ba>bd)&&(ba>be)&&(ba>bf)&&(ba>answerAA)){answerAA=ba;answerAB=13;} if ((bb>ba)&&(bb>bc)&&(bb>bd)&&(bb>be)&&(bb>bf)&&(bb>answerAA)){answerAA=bb;answerAB=14;} if ((bc>ba)&&(bc>bb)&&(bc>bd)&&(bc>be)&&(bc>bf)&&(bc>answerAA)){answerAA=bc;answerAB=15;} if ((bd>ba)&&(bd>bb)&&(bd>bc)&&(bd>be)&&(bd>bf)&&(bd>answerAA)){answerAA=bd;answerAB=16;} if ((be>ba)&&(be>bb)&&(be>bc)&&(be>bd)&&(be>bf)&&(be>answerAA)){answerAA=be;answerAB=17;} if ((bf>ba)&&(bf>bb)&&(bf>bc)&&(bf>bd)&&(bf>be)&&(bf>answerAA)){answerAA=bf;answerAB=18;} // Group D: if (p==19){bg=bg+1;} if (p==20){bh=bh+1;} if (p==21){bi=bi+1;} if (p==22){bj=bj+1;} if (p==23){bk=bk+1;} if (p==24){bl=bl+1;} if ((bg>bh)&&(bg>bi)&&(bg>bj)&&(bg>bk)&&(bg>bl)&&(bg>answerAA)){answerAA=bg;answerAB=19;} if ((bh>bg)&&(bh>bi)&&(bh>bj)&&(bh>bk)&&(bh>bl)&&(bh>answerAA)){answerAA=bh;answerAB=20;} if ((bi>bg)&&(bi>bh)&&(bi>bj)&&(bi>bk)&&(bi>bl)&&(bi>answerAA)){answerAA=bi;answerAB=21;} if ((bj>bg)&&(bj>bh)&&(bj>bi)&&(bj>bk)&&(bj>bl)&&(bj>answerAA)){answerAA=bj;answerAB=22;} if ((bk>bg)&&(bk>bh)&&(bk>bi)&&(bk>bj)&&(bk>bl)&&(bk>answerAA)){answerAA=bk;answerAB=23;} if ((bl>bg)&&(bl>bh)&&(bl>bi)&&(bl>bj)&&(bl>bk)&&(bl>answerAA)){answerAA=bl;answerAB=24;} // Group E: if (p==25){ca=ca+1;} if (p==26){cb=cb+1;} if (p==27){cc=cc+1;} if (p==28){cd=cd+1;} if (p==29){ce=ce+1;} if (p==30){cf=cf+1;} if ((ca>cb)&&(ca>cc)&&(ca>cd)&&(ca>ce)&&(ca>cf)&&(ca>answerAA)){answerAA=ca;answerAB=25;} if ((cb>ca)&&(cb>cc)&&(cb>cd)&&(cb>ce)&&(cb>cf)&&(cb>answerAA)){answerAA=cb;answerAB=26;} if ((cc>ca)&&(cc>cb)&&(cc>cd)&&(cc>ce)&&(cc>cf)&&(cc>answerAA)){answerAA=cc;answerAB=27;} if ((cd>ca)&&(cd>cb)&&(cd>cc)&&(cd>ce)&&(cd>cf)&&(cd>answerAA)){answerAA=cd;answerAB=28;} if ((ce>ca)&&(ce>cb)&&(ce>cc)&&(ce>cd)&&(ce>cf)&&(ce>answerAA)){answerAA=ce;answerAB=29;} if ((cf>ca)&&(cf>cb)&&(cf>cc)&&(cf>cd)&&(cf>ce)&&(cf>answerAA)){answerAA=cf;answerAB=30;} // Group F: if (p==31){cg=cg+1;} if (p==32){ch=ch+1;} if (p==33){ci=ci+1;} if (p==34){cj=cj+1;} if (p==35){ck=ck+1;} if (p==36){cl=cl+1;} if ((cg>ch)&&(cg>ci)&&(cg>cj)&&(cg>ck)&&(cg>cl)&&(cg>answerAA)){answerAA=cg;answerAB=31;} if ((ch>cg)&&(ch>ci)&&(ch>cj)&&(ch>ck)&&(ch>cl)&&(ch>answerAA)){answerAA=ch;answerAB=32;} if ((ci>cg)&&(ci>ch)&&(ci>cj)&&(ci>ck)&&(ci>cl)&&(ci>answerAA)){answerAA=ci;answerAB=33;} if ((cj>cg)&&(cj>ch)&&(cj>ci)&&(cj>ck)&&(cj>cl)&&(cj>answerAA)){answerAA=cj;answerAB=34;} if ((ck>cg)&&(ck>ch)&&(ck>ci)&&(ck>cj)&&(ck>cl)&&(ck>answerAA)){answerAA=ck;answerAB=35;} if ((cl>cg)&&(cl>ch)&&(cl>ci)&&(cl>cj)&&(cl>ck)&&(cl>answerAA)){answerAA=cl;answerAB=36;} // Group I: if (p==37){ea=ea+1;} if (p==38){eb=eb+1;} if (p==39){ec=ec+1;} if (p==40){ed=ed+1;} if (p==41){ee=ee+1;} if (p==42){ef=ef+1;} if ((ea>eb)&&(ea>ec)&&(ea>ed)&&(ea>ee)&&(ea>ef)&&(ea>answerAA)){answerAA=ea;answerAB=37;} if ((eb>ea)&&(eb>ec)&&(eb>ed)&&(eb>ee)&&(eb>ef)&&(eb>answerAA)){answerAA=eb;answerAB=38;} if ((ec>ea)&&(ec>eb)&&(ec>ed)&&(ec>ee)&&(ec>ef)&&(ec>answerAA)){answerAA=ec;answerAB=39;} if ((ed>ea)&&(ed>eb)&&(ed>ec)&&(ed>ee)&&(ed>ef)&&(ed>answerAA)){answerAA=ed;answerAB=40;} if ((ee>ea)&&(ee>eb)&&(ee>ec)&&(ee>ed)&&(ee>ef)&&(ee>answerAA)){answerAA=ee;answerAB=41;} if ((ef>ea)&&(ef>eb)&&(ef>ec)&&(ef>ed)&&(ef>ee)&&(ef>answerAA)){answerAA=ef;answerAB=42;} // Group J: if (p==43){eg=eg+1;} if (p==44){eh=eh+1;} if (p==45){ei=ei+1;} if (p==46){ej=ej+1;} if (p==47){ek=ek+1;} if (p==48){el=el+1;} if ((eg>eh)&&(eg>ei)&&(eg>ej)&&(eg>ek)&&(eg>el)&&(eg>answerAA)){answerAA=eg;answerAB=43;} if ((eh>eg)&&(eh>ei)&&(eh>ej)&&(eh>ek)&&(eh>el)&&(eh>answerAA)){answerAA=eh;answerAB=44;} if ((ei>eg)&&(ei>eh)&&(ei>ej)&&(ei>ek)&&(ei>el)&&(ei>answerAA)){answerAA=ei;answerAB=45;} if ((ej>eg)&&(ej>eh)&&(ej>ei)&&(ej>ek)&&(ej>el)&&(ej>answerAA)){answerAA=ej;answerAB=46;} if ((ek>eg)&&(ek>eh)&&(ek>ei)&&(ek>ej)&&(ek>el)&&(ek>answerAA)){answerAA=ek;answerAB=47;} if ((el>eg)&&(el>eh)&&(el>ei)&&(el>ej)&&(el>ek)&&(el>answerAA)){answerAA=el;answerAB=48;} // Group K: if (p==49){fa=fa+1;} if (p==50){fb=fb+1;} if (p==51){fc=fc+1;} if (p==52){fd=fd+1;} if (p==53){fe=fe+1;} if (p==54){ff=ff+1;} if ((fa>fb)&&(fa>fc)&&(fa>fd)&&(fa>fe)&&(fa>ff)&&(fa>answerAA)){answerAA=fa;answerAB=49;} if ((fb>fg)&&(fb>fc)&&(fb>fd)&&(fb>fe)&&(fb>ff)&&(fb>answerAA)){answerAA=fb;answerAB=50;} if ((fc>fg)&&(fc>fb)&&(fc>fd)&&(fc>fe)&&(fc>ff)&&(fc>answerAA)){answerAA=fc;answerAB=51;} if ((fd>fg)&&(fd>fb)&&(fd>fc)&&(fd>fe)&&(fd>ff)&&(fd>answerAA)){answerAA=fd;answerAB=52;} if ((fe>fg)&&(fe>fb)&&(fe>fc)&&(fe>fd)&&(fe>ff)&&(fe>answerAA)){answerAA=fe;answerAB=53;} if ((ff>fg)&&(ff>fb)&&(ff>fc)&&(ff>fd)&&(ff>fe)&&(ff>answerAA)){answerAA=ff;answerAB=54;} // Group L: if (p==55){fg=fg+1;} if (p==56){fh=fh+1;} if (p==57){fi=fi+1;} if (p==58){fj=fj+1;} if (p==59){fk=fk+1;} if (p==60){fl=fl+1;} if ((fg>fh)&&(fg>fi)&&(fg>fj)&&(fg>fk)&&(fg>fl)&&(fg>answerAA)){answerAA=fg;answerAB=55;} if ((fh>fg)&&(fh>fi)&&(fh>fj)&&(fh>fk)&&(fh>fl)&&(fh>answerAA)){answerAA=fh;answerAB=56;} if ((fi>fg)&&(fi>fh)&&(fi>fj)&&(fi>fk)&&(fi>fl)&&(fi>answerAA)){answerAA=fi;answerAB=57;} if ((fj>fg)&&(fj>fh)&&(fj>fi)&&(fj>fk)&&(fj>fl)&&(fj>answerAA)){answerAA=fj;answerAB=58;} if ((fk>fg)&&(fk>fh)&&(fk>fi)&&(fk>fj)&&(fk>fl)&&(fk>answerAA)){answerAA=fk;answerAB=59;} if ((fl>fg)&&(fl>fh)&&(fl>fi)&&(fl>fj)&&(fl>fk)&&(fl>answerAA)){answerAA=fl;answerAB=60;} // Group M: if (p==61){ga=ga+1;} if (p==62){gb=gb+1;} if (p==63){gc=gc+1;} if (p==64){gd=gd+1;} if (p==65){ge=ge+1;} if (p==66){gf=gf+1;} if ((ga>gb)&&(ga>gc)&&(ga>gd)&&(ga>ge)&&(ga>gf)&&(ga>answerAA)){answerAA=ga;answerAB=61;} if ((gb>fg)&&(gb>gc)&&(gb>gd)&&(gb>ge)&&(gb>gf)&&(gb>answerAA)){answerAA=gb;answerAB=62;} if ((gc>fg)&&(gc>gb)&&(gc>gd)&&(gc>ge)&&(gc>gf)&&(gc>answerAA)){answerAA=gc;answerAB=63;} if ((gd>fg)&&(gd>gb)&&(gd>gc)&&(gd>ge)&&(gd>gf)&&(gd>answerAA)){answerAA=gd;answerAB=64;} if ((ge>fg)&&(ge>gb)&&(ge>gc)&&(ge>gd)&&(ge>gf)&&(ge>answerAA)){answerAA=ge;answerAB=65;} if ((gf>fg)&&(gf>gb)&&(gf>gc)&&(gf>gd)&&(gf>ge)&&(gf>answerAA)){answerAA=gf;answerAB=66;} // Group N: if (p==67){gg=gg+1;} if (p==68){gh=gh+1;} if (p==69){gi=gi+1;} if (p==70){gj=gj+1;} if (p==71){gk=gk+1;} if (p==72){gl=gl+1;} if ((gg>gh)&&(gg>gi)&&(gg>gj)&&(gg>gk)&&(gg>gl)&&(gg>answerAA)){answerAA=gg;answerAB=67;} if ((gh>gg)&&(gh>gi)&&(gh>gj)&&(gh>gk)&&(gh>gl)&&(gh>answerAA)){answerAA=gh;answerAB=68;} if ((gi>gg)&&(gi>gh)&&(gi>gj)&&(gi>gk)&&(gi>gl)&&(gi>answerAA)){answerAA=gi;answerAB=69;} if ((gj>gg)&&(gj>gh)&&(gj>gi)&&(gj>gk)&&(gj>gl)&&(gj>answerAA)){answerAA=gj;answerAB=70;} if ((gk>gg)&&(gk>gh)&&(gk>gi)&&(gk>gj)&&(gk>gl)&&(gk>answerAA)){answerAA=gk;answerAB=71;} if ((gl>gg)&&(gl>gh)&&(gl>gi)&&(gl>gj)&&(gl>gk)&&(gl>answerAA)){answerAA=gl;answerAB=72;} // Group O: if (p==73){ha=ha+1;} if (p==74){hb=hb+1;} if (p==75){hc=hc+1;} if (p==76){hd=hd+1;} if (p==77){he=he+1;} if (p==78){hf=hf+1;} if ((ha>hb)&&(ha>hc)&&(ha>hd)&&(ha>he)&&(ha>hf)&&(ha>answerAA)){answerAA=ha;answerAB=73;} if ((hb>fg)&&(hb>hc)&&(hb>hd)&&(hb>he)&&(hb>hf)&&(hb>answerAA)){answerAA=hb;answerAB=74;} if ((hc>fg)&&(hc>hb)&&(hc>hd)&&(hc>he)&&(hc>hf)&&(hc>answerAA)){answerAA=hc;answerAB=75;} if ((hd>fg)&&(hd>hb)&&(hd>hc)&&(hd>he)&&(hd>hf)&&(hd>answerAA)){answerAA=hd;answerAB=76;} if ((he>fg)&&(he>hb)&&(he>hc)&&(he>hd)&&(he>hf)&&(he>answerAA)){answerAA=he;answerAB=77;} if ((hf>fg)&&(hf>hb)&&(hf>hc)&&(hf>hd)&&(hf>he)&&(hf>answerAA)){answerAA=hf;answerAB=78;} // Group P: if (p==79){hg=hg+1;} if (p==80){hh=hh+1;} if (p==81){hi=hi+1;} if (p==82){hj=hj+1;} if (p==83){hk=hk+1;} if (p==84){hl=hl+1;} if ((hg>hh)&&(hg>hi)&&(hg>hj)&&(hg>hk)&&(hg>hl)&&(hg>answerAA)){answerAA=hg;answerAB=79;} if ((hh>hg)&&(hh>hi)&&(hh>hj)&&(hh>hk)&&(hh>hl)&&(hh>answerAA)){answerAA=hh;answerAB=80;} if ((hi>hg)&&(hi>hh)&&(hi>hj)&&(hi>hk)&&(hi>hl)&&(hi>answerAA)){answerAA=hi;answerAB=81;} if ((hj>hg)&&(hj>hh)&&(hj>hi)&&(hj>hk)&&(hj>hl)&&(hj>answerAA)){answerAA=hj;answerAB=82;} if ((hk>hg)&&(hk>hh)&&(hk>hi)&&(hk>hj)&&(hk>hl)&&(hk>answerAA)){answerAA=hk;answerAB=83;} if ((hl>hg)&&(hl>hh)&&(hl>hi)&&(hl>hj)&&(hl>hk)&&(hl>answerAA)){answerAA=hl;answerAB=84;} // Group Q: if (p==85){ia=ia+1;} if (p==86){ib=ib+1;} if (p==87){ic=ic+1;} if (p==88){id=id+1;} if (p==89){ie=ie+1;} if (p==90){iff=iff+1;} if ((ia>ib)&&(ia>ic)&&(ia>id)&&(ia>ie)&&(ia>iff)&&(ia>answerAA)){answerAA=ia;answerAB=85;} if ((ib>fg)&&(ib>ic)&&(ib>id)&&(ib>ie)&&(ib>iff)&&(ib>answerAA)){answerAA=ib;answerAB=86;} if ((ic>fg)&&(ic>ib)&&(ic>id)&&(ic>ie)&&(ic>iff)&&(ic>answerAA)){answerAA=ic;answerAB=87;} if ((id>fg)&&(id>ib)&&(id>ic)&&(id>ie)&&(id>iff)&&(id>answerAA)){answerAA=id;answerAB=88;} if ((ie>fg)&&(ie>ib)&&(ie>ic)&&(ie>id)&&(ie>iff)&&(ie>answerAA)){answerAA=ie;answerAB=89;} if ((iff>fg)&&(iff>ib)&&(iff>ic)&&(iff>id)&&(iff>ie)&&(iff>answerAA)){answerAA=iff;answerAB=90;} // Group R: if (p==91){ig=ig+1;} if (p==92){ih=ih+1;} if (p==93){ii=ii+1;} if (p==94){ij=ij+1;} if (p==95){ik=ik+1;} if (p==96){il=il+1;} if ((ig>ih)&&(ig>ii)&&(ig>ij)&&(ig>ik)&&(ig>il)&&(ig>answerAA)){answerAA=ig;answerAB=91;} if ((ih>ig)&&(ih>ii)&&(ih>ij)&&(ih>ik)&&(ih>il)&&(ih>answerAA)){answerAA=ih;answerAB=92;} if ((ii>ig)&&(ii>ih)&&(ii>ij)&&(ii>ik)&&(ii>il)&&(ii>answerAA)){answerAA=ii;answerAB=93;} if ((ij>ig)&&(ij>ih)&&(ij>ii)&&(ij>ik)&&(ij>il)&&(ij>answerAA)){answerAA=ij;answerAB=94;} if ((ik>ig)&&(ik>ih)&&(ik>ii)&&(ik>ij)&&(ik>il)&&(ik>answerAA)){answerAA=ik;answerAB=95;} if ((il>ig)&&(il>ih)&&(il>ii)&&(il>ij)&&(il>ik)&&(il>answerAA)){answerAA=il;answerAB=96;} // Group S: if (p==97){ja=ja+1;} if (p==98){jb=jb+1;} if (p==99){jc=jc+1;} if (p==100){jd=jd+1;} if (p==101){je=je+1;} if (p==102){jf=jf+1;} if ((ja>jb)&&(ja>jc)&&(ja>jd)&&(ja>je)&&(ja>jf)&&(ja>answerAA)){answerAA=ja;answerAB=97;} if ((jb>fg)&&(jb>jc)&&(jb>jd)&&(jb>je)&&(jb>jf)&&(jb>answerAA)){answerAA=jb;answerAB=98;} if ((jc>fg)&&(jc>jb)&&(jc>jd)&&(jc>je)&&(jc>jf)&&(jc>answerAA)){answerAA=jc;answerAB=99;} if ((jd>fg)&&(jd>jb)&&(jd>jc)&&(jd>je)&&(jd>jf)&&(jd>answerAA)){answerAA=jd;answerAB=100;} if ((je>fg)&&(je>jb)&&(je>jc)&&(je>jd)&&(je>jf)&&(je>answerAA)){answerAA=je;answerAB=101;} if ((jf>fg)&&(jf>jb)&&(jf>jc)&&(jf>jd)&&(jf>je)&&(jf>answerAA)){answerAA=jf;answerAB=102;} // Group T: if (p==103){jg=jg+1;} if (p==104){jh=jh+1;} if (p==105){ji=ji+1;} if (p==106){jj=jj+1;} if (p==107){jk=jk+1;} if (p==108){jl=jl+1;} if ((jg>jh)&&(jg>ji)&&(jg>jj)&&(jg>jk)&&(jg>jl)&&(jg>answerAA)){answerAA=jg;answerAB=103;} if ((jh>jg)&&(jh>ji)&&(jh>jj)&&(jh>jk)&&(jh>jl)&&(jh>answerAA)){answerAA=jh;answerAB=104;} if ((ji>jg)&&(ji>jh)&&(ji>jj)&&(ji>jk)&&(ji>jl)&&(ji>answerAA)){answerAA=ji;answerAB=105;} if ((jj>jg)&&(jj>jh)&&(jj>ji)&&(jj>jk)&&(jj>jl)&&(jj>answerAA)){answerAA=jj;answerAB=106;} if ((jk>jg)&&(jk>jh)&&(jk>ji)&&(jk>jj)&&(jk>jl)&&(jk>answerAA)){answerAA=jk;answerAB=107;} if ((jl>jg)&&(jl>jh)&&(jl>ji)&&(jl>jj)&&(jl>jk)&&(jl>answerAA)){answerAA=jl;answerAB=108;} // Group U: if (p==109){ka=ka+1;} if (p==110){kb=kb+1;} if (p==111){kc=kc+1;} if (p==112){kd=kd+1;} if (p==113){ke=ke+1;} if (p==114){kf=kf+1;} if ((ka>kb)&&(ka>kc)&&(ka>kd)&&(ka>ke)&&(ka>kf)&&(ka>answerAA)){answerAA=ka;answerAB=109;} if ((kb>fg)&&(kb>kc)&&(kb>kd)&&(kb>ke)&&(kb>kf)&&(kb>answerAA)){answerAA=kb;answerAB=110;} if ((kc>fg)&&(kc>kb)&&(kc>kd)&&(kc>ke)&&(kc>kf)&&(kc>answerAA)){answerAA=kc;answerAB=111;} if ((kd>fg)&&(kd>kb)&&(kd>kc)&&(kd>ke)&&(kd>kf)&&(kd>answerAA)){answerAA=kd;answerAB=112;} if ((ke>fg)&&(ke>kb)&&(ke>kc)&&(ke>kd)&&(ke>kf)&&(ke>answerAA)){answerAA=ke;answerAB=113;} if ((kf>fg)&&(kf>kb)&&(kf>kc)&&(kf>kd)&&(kf>ke)&&(kf>answerAA)){answerAA=kf;answerAB=114;} // Group V: if (p==115){kg=kg+1;} if (p==116){kh=kh+1;} if (p==117){ki=ki+1;} if (p==118){kj=kj+1;} if (p==119){kk=kk+1;} if (p==120){kl=kl+1;} if ((kg>kh)&&(kg>ki)&&(kg>kj)&&(kg>kk)&&(kg>kl)&&(kg>answerAA)){answerAA=kg;answerAB=115;} if ((kh>kg)&&(kh>ki)&&(kh>kj)&&(kh>kk)&&(kh>kl)&&(kh>answerAA)){answerAA=kh;answerAB=116;} if ((ki>kg)&&(ki>kh)&&(ki>kj)&&(ki>kk)&&(ki>kl)&&(ki>answerAA)){answerAA=ki;answerAB=117;} if ((kj>kg)&&(kj>kh)&&(kj>ki)&&(kj>kk)&&(kj>kl)&&(kj>answerAA)){answerAA=kj;answerAB=118;} if ((kk>kg)&&(kk>kh)&&(kk>ki)&&(kk>kj)&&(kk>kl)&&(kk>answerAA)){answerAA=kk;answerAB=119;} if ((kl>kg)&&(kl>kh)&&(kl>ki)&&(kl>kj)&&(kl>kk)&&(kl>answerAA)){answerAA=kl;answerAB=120;} // Group W: if (p==121){lg=lg+1;} if (p==122){lh=lh+1;} if (p==123){li=li+1;} if (p==124){lj=lj+1;} if (p==125){lk=lk+1;} if (p==126){ll=ll+1;} if (p==127){lm=lm+1;} if ((lg>lh)&&(lg>li)&&(lg>lj)&&(lg>lk)&&(lg>ll)&&(lg>lm)&&(lg>answerAA)){answerAA=lg;answerAB=121;} if ((lh>lg)&&(lh>li)&&(lh>lj)&&(lh>lk)&&(lh>ll)&&(lh>lm)&&(lh>answerAA)){answerAA=lh;answerAB=122;} if ((li>lg)&&(li>lh)&&(li>lj)&&(li>lk)&&(li>ll)&&(li>lm)&&(li>answerAA)){answerAA=li;answerAB=123;} if ((lj>lg)&&(lj>lh)&&(lj>li)&&(lj>lk)&&(lj>ll)&&(lj>lm)&&(lj>answerAA)){answerAA=lj;answerAB=124;} if ((lk>lg)&&(lk>lh)&&(lk>li)&&(lk>lj)&&(lk>ll)&&(lk>lm)&&(lk>answerAA)){answerAA=lk;answerAB=125;} if ((ll>lg)&&(ll>lh)&&(ll>li)&&(ll>lj)&&(ll>lk)&&(ll>lm)&&(ll>answerAA)){answerAA=ll;answerAB=126;} if ((lm>lg)&&(lm>lh)&&(lm>li)&&(lm>lj)&&(lm>lk)&&(lm>ll)&&(lm>answerAA)){answerAA=lm;answerAB=127;} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Serial.print("Mode size is: ");Serial.println(answerAA); Serial.print("Mode position is: ");Serial.println(answerAB); Serial.print("position is: ");Serial.println(p); delay(500); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void resetValues() { val1 = digitalRead(callBackFromMaster); if (val1 == HIGH) { if (resetStatus == LOW) { resetStatus = HIGH; // digitalWrite(ledPin,HIGH); Serial.println("resetEverything = ON"); } p=0; n=0; answerAA =0; answerAB =0; count=0; aa=0; ab=0; ac=0; ad=0; ae=0; af=0; ag=0; ah=0; ai=0; aj=0; ak=0; al=0; am=0; ba=0; bb=0; bc=0; bd=0; be=0; bf=0; bg=0; bh=0; bi=0; bj=0; bk=0; bl=0; ca=0; cb=0; cc=0; cd=0; ce=0; cf=0; cg=0; ch=0; ci=0; cj=0; ck=0; cl=0; ea=0; eb=0; ec=0; ed=0; ee=0; ef=0; eg=0; eh=0; ei=0; ej=0; ek=0; el=0; fa=0; fb=0; fc=0; fd=0; fe=0; ff=0; fg=0; fh=0; fi=0; fj=0; fk=0; fl=0; ga=0; gb=0; gc=0; gd=0; ge=0; gf=0; gg=0; gh=0; gi=0; gj=0; gk=0; gl=0; ha=0; hb=0; hc=0; hd=0; he=0; hf=0; hg=0; hh=0; hi=0; hj=0; hk=0; hl=0; ia=0; ib=0; ic=0; id=0; ie=0; iff=0; ig=0; ih=0; ii=0; ij=0; ik=0; il=0; ja=0; jb=0; jc=0; jd=0; je=0; jf=0; jg=0; jh=0; ji=0; jj=0; jk=0; jl=0; ka=0; kb=0; kc=0; kd=0; ke=0; kf=0; kg=0; kh=0; ki=0; kj=0; kk=0; kl=0; la=0; lb=0; lc=0; ld=0; le=0; lf=0; lg=0; lh=0; li=0; lj=0; lk=0; ll=0; lm=0; } else { if (resetStatus == HIGH) { resetStatus = LOW; // digitalWrite(ledPin,LOW); Serial.println("resetEverything = OFF"); } } }</p> 

Articles Liés

Communication vocale numérique à débit faible

Communication vocale numérique à débit faible

Vue d'ensembleLa « communication de faible débit vocal numérique » offre une solution pour problème de communication quand apparaît une situation critique. Une situation critique pourrait être un feu de forêt, une action militaire ou une catastrophe
8 bits série numérique-convertisseur analogique (gamme 5v) pour les microcontrôleurs (quand TTL et des résistances est tout vous avez)

8 bits série numérique-convertisseur analogique (gamme 5v) pour les microcontrôleurs (quand TTL et des résistances est tout vous avez)

donc j'avais besoin d'un DAC (convertisseur numérique-analogique) à utiliser avec mon pic12F675, et pour ceux d'entre vous qui n'avez jamais entendu parler de ce petit copain, c'est un microcontrôleur 8 broches de Microchip qui a seulement 6 broches
Comment afficher des images sur 2,4 pouces TFT et en faire un cadre photo numérique

Comment afficher des images sur 2,4 pouces TFT et en faire un cadre photo numérique

J'ai vraiment eu cette volonté de construire un cadre de photo numérique de la dernière trois, jusqu'à ce mois de janvier quand j'ai eu ce module de touch tft lcd. J'étais excité, mais quand j'ai regardé sur internet trouvé très peu (Désolé aucun) ai
Chibikart : Prototypage rapide un Subminiature électrique Go-Kart à l’aide de Fabrication numérique et composants Hobby

Chibikart : Prototypage rapide un Subminiature électrique Go-Kart à l’aide de Fabrication numérique et composants Hobby

Chibikart! est un kart électrique 2WD très petit mais puissant et maniable que vous pouvez générer à l'aide de standard industriel et de composants de passe-temps et de pièces de châssis mécanosoudé numériquement. À l'aide de batteries ion-lithium mo
Comment faire un broyeur à billes avec lego et un tuyau en pvc--inclut le fichier de conception numérique

Comment faire un broyeur à billes avec lego et un tuyau en pvc--inclut le fichier de conception numérique

Bonjour et Bienvenue sur mon Instructable sur comment faire un broyeur à billes à l'aide de lego et tuyau en PVC.Cet instant instructable inclut une conception numérique 3D et 3D manuel de comment faire ce broyeur à boulets.la version Html du guide e
Déclenchement de votre reflex numérique sans fil avec le smartphone et le module Wi-fi de ESP8266

Déclenchement de votre reflex numérique sans fil avec le smartphone et le module Wi-fi de ESP8266

Il s'agit de mon premier instructable et l'anglais n'est pas ma langue maternelle, alors soyez indulgent (mais je serais reconnaissant à toute personne faisant remarquer les fautes d'orthographe, fautes de frappe...;)).Cela vous coûtera seulement que
Raspberry Pi - BH1715 numérique capteur de lumière ambiante Python Tutorial

Raspberry Pi - BH1715 numérique capteur de lumière ambiante Python Tutorial

Le BH1715 est un capteur de lumière ambiante numérique avec une interface de bus I²C. Le BH1715 est utilisé communément pour obtenir les données de lumière ambiantes pour régler la puissance de rétro-éclairage LCD et clavier pour les appareils mobile
Raspberry Pi - BH1715 numérique capteur de lumière ambiante Java Tutorial

Raspberry Pi - BH1715 numérique capteur de lumière ambiante Java Tutorial

Le BH1715 est un capteur de lumière ambiante numérique avec une interface de bus I²C. Le BH1715 est utilisé communément pour obtenir les données de lumière ambiantes pour régler la puissance de rétro-éclairage LCD et clavier pour les appareils mobile
Rapide thermomètre numérique à l’aide de TTL convertisseur USB bon marché et DS18B20 - sans Arduino ou Raspberry Pi

Rapide thermomètre numérique à l’aide de TTL convertisseur USB bon marché et DS18B20 - sans Arduino ou Raspberry Pi

Dans mon précédent instructable j'ai donné une introduction au thermomètre numérique utilisant DS18B20 et ESP8266 Conseil nodemcu avec écran OLED SPI et programmation à l'aide de IDE Arduino. Cela exigeait une connaissance de programmation, base élec
Thermomètre numérique à écran OLED utilisant le capteur de température de NodeMCU de ESP8266 ESP-12F et DS18B20

Thermomètre numérique à écran OLED utilisant le capteur de température de NodeMCU de ESP8266 ESP-12F et DS18B20

Dans mon précédent instructable j'ai donné une introduction à ESP8266 et en programmant avec notre IDE Arduino familier.Dans ce instructable je vais aller un peu plus loin, interfaçage d'un capteur de température DS18B20 et affichage de la températur
Arduino et Visuino : utilisation PCF8574/PCF8574A I2C GPIO pour ajouter plus de chaînes numériques à Arduino

Arduino et Visuino : utilisation PCF8574/PCF8574A I2C GPIO pour ajouter plus de chaînes numériques à Arduino

Peu importe combien de ports un Arduino board a, ils ne semblent jamais être suffisant pour le nouveau projet cool vous avez en tête;-). Heureusement, il existe une solution. L'Arduino possède des broches fois I2C et SPI, et il y a un certain nombre
Horloge à l’aide de 7 Segment affichage numérique contrôlé à l’aide de la télécommande de la TV

Horloge à l’aide de 7 Segment affichage numérique contrôlé à l’aide de la télécommande de la TV

il y a des variétés d'horloge numérique disponibles dans notre vie quotidienne. Base horloge numérique habituellement sera ont certaines fonctions intégrées comme réveil, calendrier et thermomètre en plus de l'affichage des informations d'horloge. Ce
Table de Plasma de commande numérique par ordinateur

Table de Plasma de commande numérique par ordinateur

Donc, vous avez acheté un coupeur de plasma et vous désirez que vous pouvez couper avec précision vos conceptions en métal. Traçant des lignes à la main donne des résultats décevants et tables de Plasma de commande numérique par ordinateur sont de so
Autocollant de fenêtre numérique (Arduino contrôlée)

Autocollant de fenêtre numérique (Arduino contrôlée)

un autocollant de taille matrice de LED qui affiche des images en séquence à partir d'une carte SD, pour produire une animation signe ou « vitrophanie ». Arduino contrôlée ! Inclut également le code de Windows, Mac et Linux pour la conversion des fic