For my project I wanted to make my 328 a stand alone one.I did not have the 16Mhz crystal, so i connected the ones connected to arduino board's 28DIP microcontroller base(pin 9 and 10).I have powered the board and also took the 5v from the board(without microcontroller) to power up the breadboard microcontroller.I initially had only one microcontroller and I programmed it keeping it on the board.After the program was uploaded, I removed it and put it on breadboard.I have connected even the reset,RX,Tx pins to the board fromy my breadboard.But it wont work.Is it the crystal or any other problem.If I burn its bootloader again selecting its internal 8Mhz crystal, will it work.If yes then how to do it, and what will happen to program which is uploaded in the 328.
Here's my code
#define HighLevel 2
#define LowLevel 4
#define Output 3
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,10,11,12,13);
void setup() {
pinMode(HighLevel, INPUT_PULLUP);
pinMode(LowLevel, INPUT_PULLUP);
pinMode(Output, OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("WELCOME TO");
lcd.setCursor(0, 1);
lcd.print("PRATIBA KARANJI");
delay(5000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("PROGRAMMED BY");
lcd.setCursor(0, 1);
lcd.print("KATHIR");
delay(5000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("PROJECT DETAILS");
delay(4200);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("MICRO CONTROLLER");
lcd.setCursor(0, 1);
lcd.print("ATmega 328");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rs.80");
delay(3800);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("LCD DISPLAY");
lcd.setCursor(0, 1);
lcd.print("16x2 CHARACTERS");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rs.90");
delay(3800);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("RELAY");
lcd.setCursor(0, 1);
lcd.print("10 Amp - DPDT");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rs.100");
delay(3800);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("EXTRAS");
lcd.setCursor(0, 1);
lcd.print("Wires, etc...");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rs.35");
delay(3800);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("TOTAL COST");
lcd.setCursor(0, 1);
lcd.print("OF PROJECT");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("80+90+100+35");
lcd.setCursor(0, 1);
lcd.print("Rs.305");
delay(5000);
}
void loop() {
int Hval = digitalRead(HighLevel);
int Lval = digitalRead(LowLevel);
if (Lval == LOW && Hval == HIGH) {
digitalWrite(Output, HIGH);
lcd.setCursor(0, 1);
lcd.print("PUMP STATUS- ON");
}
else if (Lval == LOW && Hval == LOW) {
digitalWrite(Output, LOW);
lcd.setCursor(0, 1);
lcd.print("PUMP STATUS-OFF");
}
else if (Lval == HIGH && Hval == HIGH) {
digitalWrite(Output , HIGH);
lcd.setCursor(0, 1);
lcd.print("PUMP STATUS- ON");
}
if (Lval == HIGH && Hval == HIGH) {
lcd.setCursor(0, 0);
lcd.print("WATER LEVEL- MIN");
}
else if (Lval == LOW ) {
lcd.setCursor(0, 0);
lcd.print("WATER LEVEL-HIGH");
}
else if (Hval == LOW ) {
lcd.setCursor(0, 0);
lcd.print("WATER LEVEL- LOW");
}
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.