In trying to write a program , I'm using the analog to run a thermistor, this will be calibrated later using resistors etc and getting the value right (it probably wont be 90), but i keep getting the same errors...
below is my code:
// program for egg boiling timer. timer starts when water temp reaches boiling. flashes yellow when soft boiled, then fades into red, and flashed red when hard boiled
int red = 9; // Digital pin 9 - Red LED
int yellow = 10; // Digital pin 10 - Yellow LED
int time = 5; // time/delay
int pulsewidth; // pulsewidth value (0-255)
int analog; // declare an integer variable first
// using analog pin 0 for thermistor potential divider
byte x;
void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
}
void loop() {
analog = analogRead(0); // read voltage on channel 0 and store it in variable
if(analog<90){
}
else{
delay(180000); //delay 3 mins
void loop() { //flash yellow LED for 5 seconds at 4Hz to signify soft boiled
if(x>19){
digitalWrite(10,HIGH);
delay(250);
digitalWrite(10,LOW);
delay(250);
}
x++;
}
else{
void loop() {
// slowly fade the red LED to full brightness, yellow to 0
for (pulsewidth=0; pulsewidth <= 255; pulsewidth++){
analogWrite(red, pulsewidth);
analogWrite(yellow, -pulsewidth);
delay(time);
}
}
digitalWrite(9,LOW); //reset both LEDs
digitalWrite(10,LOW);
void loop() { //flash red LED for 5 seconds at 4Hz to signify hard boiled
if(x>19){
digitalWrite(9,HIGH);
delay(250);
digitalWrite(9,LOW);
delay(250);
}
x++;
else{
}
}
}
##############################################END OF CODE#################################################
and my errors are as follows:
egg_timer_1.cpp: In function 'void loop()':
egg_timer_1:27: error: a function-definition is not allowed here before '{' token
egg_timer_1:65: error: expected }' at end of input egg_timer_1:65: error: expected
}' at end of input
PLEASE HELP
other useful info (maybe), I'm using the "arduino duemilanove or Nano w/ ATmega 328" board
rich x