I’ve been working on this Arduino project for almost 8 months now, I came into a snag with an if statement. I am using variables to try and structure lcd messages, but it’s not working and i have idea why, this is my first project and I’ve only been taking and modifying other peoples code. Please help my brain is dying. (full code bellow).
// Unsigned longs. Extended funtions
unsigned long start = 5000; // 5 seconds for lcd start up message
// Variables.
int secretCode[maximumKnocks] = {50, 25, 25, 50, 100, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Initial setup: "Shave and a Hair Cut, two bits."
int knockReadings[maximumKnocks]; // When someone knocks this array fills with delays between knocks.
int knockSensorValue = 0; // Last reading of the knock sensor.
int programButtonPressed = false; // Flag so we remember the programming button setting at the end of the cycle.
int lcdState = 0; // lcd controller
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,7,6,5,4);
void setup() {
pinMode(lockMotor, OUTPUT);
pinMode(gunMotor, OUTPUT);
lcd.begin(16,2);
lcd.print("Geniouse progwam");
lcd.setCursor(0,1);
lcd.print("has startid ");
Serial.begin(9600); // Uncomment the Serial.bla lines for debugging.
Serial.println(" This highly intelegent program has started."); // but feel free to comment them out after it's working right.
if(millis() >= start)
{
int lcdState = 1;
}
}
void loop() {
if(lcdState = 1)
{
lcd.clear();
}
I_am_zEE_HACKERMANNNNN.ino (8.26 KB)