Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the Arduino blink sketch below, implement the series of events by strobing

ID: 3842192 • Letter: U

Question

Using the Arduino blink sketch below, implement the series of events by strobing the internal LED with an SOS message. The letters are defined as: S = “. . . “ O = “- - -” S = “. . . “

Letter S is three short pulses followed by letter O which contains three long pulses. The timing sequence should be such that the “.” must be ON for 100ms followed by 100ms OFF between successive “.” pulses. The space between letters must be 500ms OFF. The “-” must be ON for 300ms followed by 100ms OFF between successive “-“ pulses.

The code sequence must be contained in the loop() function – remain in an infinite loop and DO NOT WRITE LINEAR CODE THAT SEQUENTIALLY PRINTS EACH LETTER ONLY ONCE IN THE MAIN LOOP. You must create a function for each letter(use 'for loop' for iteration)

Blink code:

int LED = 13;

void setup() {
  
pinMode(LED, OUTPUT);
}

void loop() {
digitalWrite(LED, HIGH);   
delay(100);   
digitalWrite(LED, LOW);
delay(3000);   
}

Explanation / Answer

int LED = 13;

int s = 300; //0,3 second delay for 'S' letter

int o = 800; // 0,8 second delay for 'O' letter

void setup(){

//put your setup code here, to run once:

pinMode(LED,OUTPUT);

}

void character(int speed){

digitalWrite(LED,HIGH);

delay(speed);

digitalWrite(LED,LOW);

delay(300);

}

void loop(){

//put your main code here, to run repeatedly:

for(int x = 1; x <= 3; x++){

character(s);

}

delay(100);

for(int x = 1; x <= 3; x++){

character(o);

}

delay(100);

for(int x = 1; x <= 3; x++){

character(s);

}

delay(3000);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote