Étape 2: programmation...
avant de commencer il faut que la programmation est une bonne chose que vous devez obtenir le mode correct:)
maintenant, allez et prenez un TRIPLE expresso
parce que le code est simple mais délicate (très!) - si vous souhaitez tester le code, ou trop paresseux pour écrire mes fichiers de code est fixé juste compiler et télécharger il!-
tous fait permet de commencer :
-tout d’abord nous devons mais la LED dans son droit alors place mais la plus grande partie dans la broche 13 et le plus court dans la broche GND comme photos de th.
-maintenant, tout est prêt connecter l’arduino à l’ordinateur et déjeuner l’arduino IDE - n’oubliez pas de sélectionner le port -
-Il est temps de programmation: D,,,
pour commencer à programmer, que vous devez d’abord télécharger la référence pour connaître les codes, voici quelques explications et comment nous le faisons avec arduino :
-maintenant, vous devez comprendre certains points
-la dot et le tableau de bord, le point est le bruit court en code morse et le tableau de bord est le long j’ai pris le temps pour le point est de 300 millisecondes et causer des 900 pour le tableau de bord le tableau de bord est point triple.
-vous trouverez le temps et la longueur du code morse sur la photo de référence, peut-être que vous trouverez le temps j’ai mais différent dans certains cas, si vous plaisait post et je vais vous expliquer.
-le code...
//morse_code by LED/* This code was written by Ebrahim Bawazir in 2013 and updated in 2015 U R FREE TO USE IT AND MODIFY IT AS U WANT ***************** */ int led =13;//the led pin char input;// to save the input void setup () { pinMode (led,OUTPUT);//tell that the 13 pin is an output Serial.begin(9600);//for the connect with the boared }void loop () { if (Serial.available()) { input = Serial.read();//read the input if (input == 'a' || input == 'A') {lA();}//if the input is a or A go to function lA if (input == 'b' || input == 'B') {lB();}//same but with b letter if (input == 'c' || input == 'C') {lC();} if (input == 'd' || input == 'D') {lD();} if (input == 'e' || input == 'E') {lE();} if (input == 'f' || input == 'F') {lF();} if (input == 'g' || input == 'G') {lG();} if (input == 'h' || input == 'H') {lH();} if (input == 'i' || input == 'I') {lI();} if (input == 'j' || input == 'J') {lJ();} if (input == 'k' || input == 'K') {lK();} if (input == 'l' || input == 'L') {lL();} if (input == 'm' || input == 'M') {lM();} if (input == 'n' || input == 'N') {lN();} if (input == 'o' || input == 'O') {lO();} if (input == 'p' || input == 'P') {lP();} if (input == 'q' || input == 'Q') {lQ();} if (input == 'r' || input == 'R') {lR();} if (input == 's' || input == 'S') {lS();} if (input == 't' || input == 'T') {lT();} if (input == 'u' || input == 'U') {lU();} if (input == 'v' || input == 'V') {lV();} if (input == 'w' || input == 'W') {lW();} if (input == 'x' || input == 'X') {lX();} if (input == 'y' || input == 'Y') {lY();} if (input == 'z' || input == 'Z') {lZ();} if (input == '1') {n1();}// the numbers if (input == '2') {n2();} if (input == '3') {n3();} if (input == '4') {n4();} if (input == '5') {n5();} if (input == '6') {n6();} if (input == '7') {n7();} if (input == '8') {n8();} if (input == '9') {n9();} if (input == '0') {n0();} if (input == ' ') {space();}//the space Serial.println (input);//print the latter saved in the input var } } //fonctions for the letters and the numbers void lA () {dot();dash();shortspace();}//letter A in morse code! void lB () {dash();dot();dot();dot();shortspace();}//same for B void lC () {dash();dot();dash();dot();shortspace();} void lD () {dash();dot();dot();shortspace();} void lE () {dot();shortspace();} void lF () {dot();dot();dash();dot();shortspace();} void lG () {dash();dash();dot();shortspace();} void lH () {dot();dot();dot();dot();shortspace();} void lI () {dot();dot();shortspace();} void lJ () {dot();dash();dash();dash();shortspace();} void lK () {dash();dot();dash();shortspace();} void lL () {dot();dash();dot();dot();shortspace();} void lM () {dash();dash();shortspace();} void lN () {dash();dot();shortspace();} void lO () {dash();dash();dash();shortspace();} void lP () {dot();dash();dash();dot();shortspace();} void lQ () {dash();dash();dot();dash();shortspace();} void lR () {dot();dash();dot();shortspace();} void lS () {dot();dot();dot();shortspace();} void lT () {dash();shortspace();} void lU () {dot();dot();dash();shortspace();} void lV () {dot();dot();dot();dash();shortspace();} void lW () {dot();dash();dash();shortspace();} void lX () {dash();dot();dot();dash();shortspace();} void lY () {dash();dot();dash();dash();shortspace();} void lZ () {dash();dash();dot();dot();shortspace();} void n1 () {dot();dash();dash();dash();dash();shortspace();}//number 1 in morse code void n2 () {dot();dot();dash();dash();dash();shortspace();} void n3 () {dot();dot();dot();dash();dash();shortspace();} void n4 () {dot();dot();dot();dot();dash();shortspace();} void n5 () {dot();dot();dot();dot();dot();shortspace();} void n6 () {dash();dot();dot();dot();dot();shortspace();} void n7 () {dash();dash();dot();dot();dot();shortspace();} void n8 () {dash();dash();dash();dot();dot();shortspace();} void n9 () {dash();dash();dash();dash();dot();shortspace();} void n0 () {dash();dash();dash();dash();dash();shortspace();} void space () {delay (1200);}//space between words void dot () {digitalWrite(led,HIGH); delay (300); digitalWrite(led,LOW); delay (300);}//the dot this code make the led on for 300 than off for 300 void dash () {digitalWrite(led,HIGH); delay (900); digitalWrite(led,LOW); delay (300);}//the dash this code make the led on for 900 than off for 300 void shortspace () {delay(600);}//space between letters /*done*/
Demandez à n’importe quel Q et je vais répondre.