Stap 2: programmeren...
voordat ik u moet dat de programmering een leuk is ding gewoon je nodig hebt om de juiste modus :)
Ga nu en neem een TRIPLE-ESPRESSO
want de code is eenvoudig maar lastig (zeer!) - als u liever de code te testen of te lui om het te schrijven mijn codebestanden is aangesloten gewoon compileren en upload het!-
alle gedaan laat begin:
-Ten eerste moeten we maar de LED in het recht plaats zo maar het groter deel in de 13 pin en de kortere GND pin als th pics.
-nu alles klaar is sluit de arduino op de computer en lunch van de arduino IDE - Vergeet niet om de poort te selecteren -
-het tijd de programmering: D,,,
om te beginnen moet u eerst downloaden van de verwijzing om te weten van de codes, is dit enige uitleg en hoe zullen wij het met arduino:
-Nu moet u begrijpen sommige punten
-de stip en het streepje, de stip is de korte klank in morse code en de dash is de lange ik de tijd maakte voor de stip 300 milliseconden is en 900 voor de dash leiden het streepje tot is triple dot.
-vindt u de tijd en de lengte van de morse-code in de verwijzing pic, misschien vindt u het tijd ik maar anders in sommige situatie als je please post en ik zal uitleggen.
-de 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*/
Elke Q vragen en ik zal reageren.