Good Afternoon
looked at the blink without delay. I feel I understand the function but it isn't working for me I don't understand why
looked at the blink without delay. I feel I understand the function but it isn't working for me I don't understand why
Code:
#include <Arduino.h>
#include <potentiometer.h>
#include <OLED.h>
#include <rtc.h>
//#include <LED.h>
#include <wire.h>
//*****************************************Declare*****************************//
// Function prototyping
const int timer12 = 13; // setting timer to ditigal pin 13 for LED example
void setup();
int replaystate = LOW; // a state for the relay
unsigned long previousMillis = 0; // stores last updated vaule of relay
const long interval12 = 2000;
void timer();
//*****************************************Declare*****************************//
//******************************************Main******************************//
int main()
{
Potentiometer PotentiometerO;
OLED OLEDO;
OLEDO.intdisplay();
displaytime();
//ledblink();
timer(); // Will this allow while loop to run or will it not before the void loop will not end?
while (true)
{
PotentiometerO.getpot();
OLEDO.OLEDdraw(PotentiometerO.getpot());
}
return (0);
} // end int main
//******************************************Main******************************//
//******************************************Setup*****************************//
void setup()
{
// set the digital relay pin an output
pinMode(timer12, OUTPUT); // setting pin 3 to an output pin
} //end setup
//******************************************Setup*****************************//
//*****************************************Functions**************************//
void timer()
{
//check to see if it is time to turn on the relay
unsigned long currentMillis = millis();
if ((currentMillis - previousMillis) >= interval12)
{
// save the last time you turned on the relay
previousMillis = currentMillis;
// if the relay is off turn it on and vice-versa:
if (replaystate == LOW)
{
replaystate = HIGH;
}
else
{
replaystate = LOW;
}
digitalWrite(timer12, replaystate); // setting the relay state to the realy pinout
}
} // end timer
//*****************************************Functions**************************//