Étape 6: Code d’Upload
Maintenant, c’est vraiment amusant. Nous avons accès à chaque LED la Flake. Utilisez votre imagination ou mon code. Utilisez l’IDE Arduino pour télécharger sur votre Arduino comme d’habitude. Ce code disparaît au hasard un voyant allumé ou éteint. Il y a tellement de potentiel. Beaucoup dont ma femme me pencherai comme elle apprend à programmer.
int maxi=1000; int i=0; int pins[6] = { 0, 0,0,0,0,0}; voidsetup() { pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); } voidloop() { int r; r=random(8,14); int state= pins[r-8]; if(state==1) { pins[r-8]=0; i=0; while(i<maxi) { i++; digitalWrite(r, HIGH); // set the LED on delayMicroseconds(maxi-i); digitalWrite(r, LOW); // set the LED on delayMicroseconds(i); } } else { pins[r-8]=1; i=0; while(i<maxi) { i++; digitalWrite(r, LOW); // set the LED on delayMicroseconds(maxi-i); digitalWrite(r, HIGH); // set the LED on delayMicroseconds(i); } } }