//REMOTE CONTROLLED LIGHT CODE
void setup() 
{
  pinMode(7, OUTPUT);
  pinMode(13,OUTPUT);
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Write 1 to Turn relay on and 2 to off");
}

void loop()
{
  if (Serial.available())
  {
    int state = Serial.parseInt();
    if (state == 1)
    {
     digitalWrite(7, HIGH);
     digitalWrite(13, LOW);
     Serial.println("Command completed relay turned OFF ------");
    }
    if (state == 2)
    {
     digitalWrite(7, LOW);
     digitalWrite(13, HIGH);
     Serial.println("Command completed relay turned ON |||||||");
    }  
  }
}
//PWM SIGNAL GENERATOR
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(4);

int potPin = 0;   
int potValue = 0; 
int led = 9; 
void setup() {    
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c);  
  display.clearDisplay();
  pinMode(led, OUTPUT);
}

void loop() {     
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.clearDisplay(); 
  display.setCursor(40,10); 
  potValue = analogRead(potPin);  
  display.print((potValue-23)/10);  
  display.print(" %");  
  analogWrite(led, potValue/4); 
  display.drawRect(0,0, display.width()-1, display.height()-1, WHITE);  
  delay(10);  
  display.display();
}