Please, when i uploaded my program too my Arduino board it worked but now i a re-uploading same code again after changing it the fiest time its not working?
Welcome. Think about how little we can know about your project. I guess you skipped over the instructions about how to provide information so people can help.
Am working on an industrial power supply by integral switching without generating harmonics..
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int totalColumns = 16;
int totalRows = 2;
//I2C pin declearation
LiquidCrystal_I2C lcd(0*27, totalColumns, totalRows);
int AC_LOAD=3; //Output to Opto Triac pin
int dimming=128; //Dimming level (0-128) 0=ON, 128=OFF
int push_one=4;
int push_two=5;
int push_three=6;
int push_four=7;
int count=5;
void setup()
{
pinMode(push_one,INPUT);
pinMode(push_two,INPUT);
pinMode(push_three,INPUT);
pinMode(push_four,INPUT);
lcd.init(); //initialize the lcd
lcd.backlight(); //To Power ON the backlight
//lcd.backlight(); //To Power OFF the backlight
pinMode(AC_LOAD, OUTPUT);//Set AC Load pin as output
attachInterrupt(0, zero_cross_int, RISING); //Choose the zero cross interrupt from the table above
}
//the interrupt function must take no parameters and return nothing
void zero_cross_int() //function to be fired at the zero crossing to dim the light
{
//Firing angle calculation : 1 full 50Hz wave=1/50=20ms
//Every zero crossing thus: (50Hz)-> 10ms (1/2 Cycle)
//For 60Hz=> 8.33ms(10.000/120)
//10ms=10000us
//(10000us-10us) /128-75 (Approx) For 60Hz=>65
int dimtime=(75*dimming); //For 60Hz=>65
delayMicroseconds(dimtime);//Wait till firing the TRIAC
digitalWrite(AC_LOAD, HIGH); //Fire the TRIAC
delayMicroseconds(10); //Triac On propogation delay(for 60Hz use 8.33)
digitalWrite(AC_LOAD, LOW); //No longer trigger the Triac(the next zero crossing will switch it off)TRIAC
}
void loop() {
if(digitalRead(push_three)==0)
{
lcd.setCursor(0,0); //Defining position to write from first row, first column .
lcd.print("DIMMING SET");
lcd.setCursor(0,2); //Defining position to write from first row, first column .
lcd.print("HIGH TO LOW");
for(int i=5;i<=128;i++){
dimming=i;
delay(10);
}
}
if(digitalRead(push_four)==0)
{
lcd.setCursor(0,0); //Defining position to write first row, first column .
lcd.print("VERY LOW PULSES");
dimming=120;
delay(10);
}
else
{
if(digitalRead(push_one)==0)
{
count=count+5;
lcd.setCursor(0,0); //Defining position to write from first row,frist column .
lcd.print("PULSE LEVEL:");
lcd.print(count);
dimming=count;
delay(100);
lcd.clear();
}
if(digitalRead(push_one)==1)
{
lcd.setCursor(0,0); //Defining position to write from first row, first column .
lcd.print("PULSE LEVEL:");
lcd.print(count);
dimming=count;
delay(50);
lcd.clear();
}
if(digitalRead(push_two)==0)
{
count=count-5;
lcd.setCursor(0,0); //Defining position to write from first row,first column .
lcd.print("PULSE LEVEL:");
lcd.print(count);
dimming=count;
delay(100);
lcd.clear();
}
else
{
lcd.setCursor(0,0); //Definig position to write from first row, first column .
lcd.print("PULSE LEVEL:");
lcd.print(count);
dimming=count;
delay(50);
lcd.clear();
}
}
}
[quote="Jc-Nak, post:1, topic:1015952, full:true"]
Please, when i uploaded my program too my Arduino board it worked but now i a re-uploading same code again after changing it the fiest time its not working?
[/quote]
This is my program code above...
I think that should be
LiquidCrystal_I2C lcd(0x27, totalColumns, totalRows);
(0x27, not 0*27)
Thank you so much:+1:![]()
.....