Where does the loop() function end ?
void loop()
{
{
if (int(Thermistor(analogRead(thermpin))) >= cutofftemp) // This prevents any activations if the temperature is too high
{
cooldown();
}
if (digitalRead(menupin) == HIGH) // This changes the menu if the menu button is pressed
{
delay(debouncepause);
menuchange();
}
if (digitalRead(weldbuttonpin) == HIGH) // This begins a weld when the weld button is pressed
{
delay(debouncepause);
weld();
}
valor = map(analogRead(A0), 0, 1024, 10000, 10);
//In my case I've used valor = map(analogRead(A0),0,1024,7200,10); for better results
if (detectado)
{
delayMicroseconds(valor); //This delay controls the power
digitalWrite(3, HIGH);
delayMicroseconds(100);
digitalWrite(3, LOW);
detectado = 0;
}
}
//This is the interruption routine
//----------------------------------------------
ISR(PCINT0_vect) //Input from optocoupler
{
if (PINB & B00000001) //We make an AND with the pin state register, We verify if pin 8 is HIGH???
{
etc, etc