Project Source Code: //program To
Project Source Code: //program To
Project Source Code: //program To
###
//Program to
#define triacPulse 10
#define SW 7
int x=0;
void setup() {
Serial.begin(9600);
pinMode(2, INPUT);
pinMode(triacPulse, OUTPUT);
pinMode(SW, INPUT);
digitalWrite(SW, HIGH);
lcd.setCursor(0,0); //Initially set the cursor position of LCD to 1st Columb 1st row.
lcd.setCursor(0,1); //Initially set the cursor position of LCD to 1st Columb 2nd row.
delay(3000);
lcd.setCursor(0,0);
lcd.setCursor(0,1);
delay(3000);
lcd.setCursor(0,1);
lcd.print(" ");
void loop() {
lcd.setCursor(0,0);
if (!digitalRead(SW)) {
x=analogRead(A0);
// enable power
lcd.setCursor(11,0);
lcd.print("ON ");
lcd.setCursor(6,1);
lcd.print((analogRead(A0) * 7) + 200);
} // end if
else if (digitalRead(SW)) {
lcd.print("OFF ");
lcd.setCursor(0,1);
lcd.print(" ");
} // else
} // end loop
void acon()
digitalWrite(triacPulse, HIGH);
delayMicroseconds(50);
// delay 50 uSec on output pulse to turn on triac
digitalWrite(triacPulse, LOW);
###