Ans part 1)
Morse SOS code of light means the LED must blink 3 times for short duration and 3 times for long duration and continue in this manner.
int LED = 13;
// the setup function runs once when you press reset or power the
board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
int i;
for (i=0;i<3;i++)
{
digitalWrite(LED, HIGH);
delay(250);
digitalWrite(LED, LOW);
delay(250);
}
for (i=0;i<3;i++)
{
digitalWrite(LED, HIGH);
delay(750);
digitalWrite(LED, LOW);
delay(750);
}
}

Ans 2)
CODE:
int led = 11; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 25;// how many points to fade the LED by
int pushButton1 = 2;
int pushButton2 = 4;
// the setup routine runs once when you press reset:
void setup() {
// declare pin 11 to be an output:
pinMode(led, OUTPUT);
pinMode(pushButton1, INPUT);
pinMode(pushButton2, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
int buttonState1 = digitalRead(pushButton1);
int buttonState2 = digitalRead(pushButton2);
if(buttonState1 == HIGH)
{
brightness = brightness + fadeAmount;
analogWrite(led, brightness);
}
if(buttonState2 == HIGH)
{
brightness = brightness - fadeAmount;
analogWrite(led, brightness);
}
Serial.print(brightness);
delay(100);
}


The maximum value for brightness is 255 and minimum value is 0
In order to overcome this problem some boundary condition must be set like if brightness = 255 then it will remain fixed at that value and won't increase further. Similarly it becomes constant when minimum value = 0 is reached.
Lab 1-Lab Portion Part I Copy the Blink program from Figure 1-13 (page 17) in the textbook and run it on your Arduino. After verifying that the Blink program works, modify the program to make the...
Need help in filling the missing lines in the program template provided down below. (Arduino Uno). Using the program template provided, fill in the missing lines in the program which increments an unsigned integer variable when the “pin 2” button is pressed and decrements an unsigned integer variable when the “pin 3” button is pressed. Your program must display the integer variable (modulo 8) on the 7-segment LED display you designed in the previous lab. Once again you should be...