Skip to main content

IOT Experiment -2

 IOT Experiment -2 

LED INTENSITY VARIATION

SORCE CODE:


void Setup() 
{
 // initialize digital pin 5,6,7 & 8 as an output.
 pinMode(5, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(7, OUTPUT);
 digitalWrite(5, HIGH);
 digitalWrite(6, HIGH);
 digitalWrite(7, HIGH);
 }
 
void Loop() 
{
 digitalWrite(5, HIGH);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
 delay(500);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
delay(500);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
delay(500);
int red_light_pin= 7;
int green_light_pin = 6;
int blue_light_pin = 5;
int count = 0;
void setup() {
  pinMode(red_light_pin, OUTPUT);
  pinMode(green_light_pin, OUTPUT);
  pinMode(blue_light_pin, OUTPUT);
}
void loop()
{
  if (count >= 0 && count<=100)
  {
  RGB_color(255, 0, 255); // Yellow
  delay(50);
  count++;
  }
  else if (count >= 101 && count<=200)
  {
  RGB_color(0, 0, 255); // Green
  delay(50);
  count++;
  }
  else
  {
  RGB_color(255,0 , 0); // Red
  delay(50);
  count++;
  }
   
}
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{
      digitalWrite(red_light_pin, red_light_value);
      digitalWrite(green_light_pin, green_light_value);
      digitalWrite(blue_light_pin, blue_light_value);
}


Comments

Popular posts from this blog

Sem 8 Practical Exam

 DC LAB ASSIGNMENTS  https://github.com/siddharthlanke/Sem-VIII-Academic-Labs/tree/main LAB-1 LAB-2 LAB-3 LAB-4 https://colab.research.google.com/drive/1wf96qi9RH3oGN039QbcmU6s3PEY6txn7?usp=sharing LAB-5 https://colab.research.google.com/drive/1i_a5owxrYdRB1ZQPa6vWGsKdC0ALiSHU?usp=sharing LAB-6 https://colab.research.google.com/drive/1CdPxCss_ppyZf4rCdiEl12CQSarvTBh9?usp=sharing CI LAB ASSIGNMENTS  LAB-1 https://colab.research.google.com/drive/1s07YgacC2nTC-vQUxtT3dKifgKZBwCaI?usp=sharing LAB-2 https://colab.research.google.com/drive/1wj6x-eunLDBx3J8Q-nheShHTMftyvgDu?usp=sharing LAB-3 https://colab.research.google.com/drive/1gw4ZekLF5WYVg3r4Rn0gnwKg177rkMmo?usp=sharing LAB-4 https://colab.research.google.com/drive/1WO0bPhM_y3xSMrNLJBjvVQ7gNpGJHCys?usp=sharing DL LAB ASSIGNMENTS  LAB-1 LAB-2 https://colab.research.google.com/drive/1324qVAvwPeqWoOQgEZ7SHRXwCVQVVZs1?usp=sharing LAB-3 https://colab.research.google.com/drive/1RCX1xvUXex6ksUtQtnj5zpoOGM_fipbr?usp=sharing LAB-4 https://colab.

Sem 7 Practical Exam

 ML LAB ASSIGNMENTS  LAB-1 https://colab.research.google.com/drive/1iQXKgk2nsysWXnO7xbajrSjGcYlReIhE LAB-2 https://colab.research.google.com/drive/1Ilmd52oXNojLpIUKNpVGkDiweL3smrvz LAB-3 https://colab.research.google.com/drive/1U6tD9lT7ktMxfDFVQRXTGGMh7sSA_-Sf LAB-4 https://colab.research.google.com/drive/1S3LFQdfJ0sodYIrNBIvCbuineHN5xRBs LAB-5 https://colab.research.google.com/drive/1u61o7jXxmqw4gnvF-YBKHElMDjHDwBSN LAB-6 https://colab.research.google.com/drive/1-LdxSoE2oKJr9Q84qWPH4Xo5uM7aDvLB QAI LAB ASSIGNMENTS  LAB-1 https://colab.research.google.com/drive/1w8j9LEK_ihcgc6QYhR-s_WQ0FZLbcF3t LAB-2 https://colab.research.google.com/drive/1l10kBvC7qNS2L17f3VBmpyDpNFlG2Mj7 LAB-3 https://colab.research.google.com/drive/1V2u0BZP63lZT9rMYRTcs88XnMNK0Uz6z LAB-4 https://colab.research.google.com/drive/1i7NJukPd-TQ5VAJP02TEOKCArEylmoGp LAB-6 https://colab.research.google.com/drive/1EvbH1DuDC06dkHCJi4XUd6iG87w3DhAl DMV LAB ASSIGNMENTS  LAB-1 https://colab.research.google.com/drive/1YHv4aatqmi