I’m in need of any advice on adding a button to my project to control a LED light strip. I have already tried to incorporate it in my sketch with no luck, It does not break out of the loop . I was hoping by adding a button to pin one as well as adding an interrupt. Any help would be great.
#include “PCD8544.h”
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
PCD8544 nokia = PCD8544(7, 6, 5, 4, 3);
int sensorPin = 0;
void setup() {
// Serial.begin(9600);
pinMode (11 , OUTPUT);
pinMode (10 , OUTPUT);
nokia.init();
nokia.setContrast(40);
nokia.command(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYALLON);
delay(500);
// back to normal
nokia.command(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL);
nokia.clear();
}
void loop() {
nokia.display();
nokia.setCursor(0, 0);
nokia.print(“Kevin’s CNC “);
nokia.setCursor(0, 15);
nokia.print(” Controoler”);
int reading = analogRead(sensorPin);
float voltage = reading * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100 ;
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
// Serial.print(temperatureF); Serial.println(" degrees F");
nokia.setCursor(10, 30);
nokia.print(temperatureF);
{
if (temperatureF >= 90 ){
digitalWrite (11,HIGH);
digitalWrite (10,HIGH); // led yellow to show warm
delay(250);
digitalWrite (10,LOW); // led yellow to show warm
delay(250);
nokia.setCursor(10, 40);
nokia.print(“TEMP RISING”);
}
else if (temperatureF <= 85) {
digitalWrite (10,LOW );
digitalWrite (11,LOW );
}
else
{
digitalWrite (11,LOW );
nokia.setCursor(10, 40);
nokia.print(" ");
}
}
}