TA的每日心情 | 开心 2023-1-28 16:20 |
---|
签到天数: 980 天 连续签到: 1 天 [LV.10]以坛为家III
|
- int pin = 13;
- void setup()
- {
- pinMode(pin, OUTPUT);
- }
- void loop()
- {
- fanyi("arduino");
- delay(2500);
- }
- void fanyi(char str1[72]){
- int i=0;
- while(str1[i]!='\0'){
- switch (str1[i]){
- case 'a':dot();dash();break;
- case 'b':dash();dot();dot();dot();break;
- case 'c':dash();dot();dash();dot();break;
- case 'd':dash();dot();dot();break;
- case 'e':dot();break;
- case 'f':dot();dot();dash();dot();break;
- case 'g':dash();dash();dot();break;
- case 'h':dot();dot();dot();dot();break;
- case 'i':dot();dot();break;
- case 'j':dot();dash();dash();dash();break;
- case 'k':dash();dot();dash();break;
- case 'l':dot();dot();dash();dot();dot();break;
- case 'm':dash();dash();break;
- case 'n':dash();dot();break;
- case 'o':dash();dash();dash();break;
- case 'p':dot();dash();dash();dot();break;
- case 'q':dash();dash();dot();dash();break;
- case 'r':dot();dash();dot();break;
- case 's':dot();dot();dot();break;
- case 't':dash();break;
- case 'u':dot();dot();dash();break;
- case 'v':dot();dot();dot();dash();break;
- case 'w':dot();dash();dash();break;
- case 'x':dash();dot();dot();dash();break;
- case 'y':dash();dot();dash();dash();break;
- case 'z':dash();dash();dot();dot();break;
- case '0':dash();dash();dash();dash();dash();break;
- case '1':dot();dash();dash();dash();dash();break;
- case '2':dot();dot();dash();dash();dash();break;
- case '3':dot();dot();dot();dash();dash();break;
- case '4':dot();dot();dot();dot();dash();break;
- case '5':dot();dot();dot();dot();dot();break;
- case '6':dash();dot();dot();dot();dot();break;
- case '7':dash();dash();dot();dot();dot();break;
- case '8':dash();dash();dash();dot();dot();break;
- case '9':dash();dash();dash();dash();dot();break;
- }
- i++;
- delay(250);
- }
- }
- void dot()
- {
- digitalWrite(pin, HIGH);
- delay(250);
- digitalWrite(pin, LOW);
- delay(250);
- }
- void dash()
- {
- digitalWrite(pin, HIGH);
- delay(750);
- digitalWrite(pin, LOW);
- delay(250);
- }
复制代码 |
|