void setup() { #include #include #include
pinMode(a6, OUTPUT);
pinMode(a7,OUTPUT);
pinMode(d5, OUTPUT);
//I dont know the exact pins fo the module clock so I mad eup one called
using namespace std;
int main()
int sec_prev=0;
while (1)
{
int seconds, minutes, hours;
string str;
I am struggling to get my analog pins to upload correctly. I declared both pins (a6, and a7) as outputs in the void setup however I keep getting the same error message. Also, it is saying: "iostream: No such file or directory" and the same thing for ctime.
Your 'a6' and 'a7' problems are partly because the analog input pins are 'A6' and 'A7' and partly because those two pins don't have digital I/O capability. They can only do analogRead() so you can't use pinMode(), digitalRead(), digitalWrite() or analogWrite() on them.
Your 'd5' problem is that the pin is called '5', not 'd5' or 'D5'.
The iostream library is not included. I would get used to using Serial for output.
The Arduino Nano doesn't have an operating system to supply time information. If you need clock time you would generally add a Real-Time Clock (RTC) chip and libraries.
You should be defining "void loop()" instead of "main()" and "while (1)".
There is no operating system so you can't use "system()" to run OS command lines.
the Arduino nano is connected to the rtc (which I forgot to mention) through pins A6 and A7 and I already have the correct rtc libraries installed for my specific rtc model so why wouldn't system () work. Also, what should I replace" #include<iostream, #include<ctime, #include<cstdlib" with using serial? And I apologize for not posting the current sketch so here it is:
void setup() { #include #include #include
analogRead(A6, OUTPUT);
analogRead(A7,OUTPUT);
pinMode(5, OUTPUT);
//I dont know the exact pins fo the module clock so I mad eup one called
using namespace std;
}
void loop(){
That's never going to work unless you have an RTC with two ANALOG outputs. None that I know of do. What type of RTC do you have? I recommend the DS3231 for accuracy. That will connect to the Wire/I2C/TWI bus which shares pins A4 and A5 on the Arduino UNO and Nano. It uses A4 and A5 for the specialized interface hardware, not as analog inputs, so you can't substitute any other pins.
You will need a library (or two) for the RTC. Pick one that supports your chip and try some of the example sketches that come with the library.
I do have the DS3231 and the libraires for it installed and in your fixed version of it, does the clock module automatically communicate to the Arduino through analog pins A4 and A5 becuase I thought you had to clarify which pins you are communicating with and in your code, you never declared A4 and A5 as outputs and when I plugged in your code it said time_t was not declared in the scope