# Code not working as expected,

**URL:** <https://forum.arduino.cc/t/code-not-working-as-expected/1071086>\
**Category:** Programming\
**Created:** [December 30, 2022, 3:25am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086 "2022-12-30T03:25:41Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![amitf](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/amitf/32/1057288_2.png) [@amitf](https://forum.arduino.cc/u/amitf)\
**Post date:** [January 1, 2023, 2:23pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/21 "2023-01-01T14:23:50Z")

</div>

here is a sketch  
hope this work. i haven't tested it

```cpp
#include "RTClib.h"

RTC_DS1307 rtc;
const int StartTime = 9;
const int refresh = 30; // time in minute to change brigtness
const int steps = 4; // increaserease or decreaserease every half hour by 3 step
int TotalMin;
int currentHour;
int currentMinutes;
int increase;

int j [3] = {9, 10, 11}; //rgb led pins red D9, green D10 , blue D11

void setup () {
  for (int i : j) {
    pinMode(i, OUTPUT); // setup ur rgb led pin
    analogWrite(i, 255); // turn on lights one by one
    delay (500);
    analogWrite(i, 0); // and turn off after half second delay (comment out if you dont like it )
  }
  Serial.begin(115200);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC"); // will print
    Serial.flush();
    abort();
  }
}

void loop () {

  DateTime now = rtc.now();

  currentHour = now.hour(); // storing hours
  currentMinutes = now.minute(); //minutes
  TotalMin = (currentHour * 60) + currentMinutes; //total minutes

  int decrease = ((((TotalMin - (StartTime * 60)) / refresh) * steps) - 70) * (-1); // justa a formula to decrease the value
  increase = ((TotalMin - (StartTime * 60)) / refresh) * steps;
  if (currentHour >= 9 && currentHour <= 17) {
    analogWrite(9, 255);
    analogWrite(10, 100);
    if (currentHour >= 9 && currentHour <= 13) {
      analogWrite(11, increase);
    }
    if (currentHour >= 14 && currentHour <= 17) {
      analogWrite(11, decrease);
    }

  }
  else {
    for (int i : j) {
      analogWrite(i, 0);

    }

  }

  delay(60000); // 1 minute delay
}

```

to understand the code properly you only need a little knowledge of for loop, if-else, operators and variables

---

<div class="post-metadata">

**Author:** ![amitf](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/amitf/32/1057288_2.png) [@amitf](https://forum.arduino.cc/u/amitf)\
**Post date:** [January 1, 2023, 2:33pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/22 "2023-01-01T14:33:53Z")

</div>

also it will look more beautiful if green also fade in evening which will give a reddish look

like this

 ![photo-1616036740257-9449ea1f6605](https://europe1.discourse-cdn.com/arduino/original/4X/3/7/0/3708cedbc2d2e27b726d2a64bcb358b532f5d848.jpeg)

---

<div class="post-metadata">

**Author:** ![amitf](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/amitf/32/1057288_2.png) [@amitf](https://forum.arduino.cc/u/amitf)\
**Post date:** [January 1, 2023, 2:42pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/23 "2023-01-01T14:42:07Z")

</div>

you need to set the time to RTC before uploading this code

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 2, 2023, 12:16am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/24 "2023-01-02T00:16:25Z")

</div>

Thank you everyone. Managed to solve it.

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 2, 2023, 3:56am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/25 "2023-01-02T03:56:49Z")

</div>

Hi Stefan, your code worked for me. However, I now have troubles integrating the RTC into my circuit. Here's the information I have.

1. On one Arduino board, the code worked flawlessly. The port COM5 was in use. But on the arduino board inside my lamp, when I connected my laptop to it, it said COM5 had an error connecting to it and only COM7 worked. But I had not changed the USB port I used on my laptop.

2. On the board inside my lamp, when I tried to get an RTC reading, it started going haywire and printing out random characters and dates. The date was stuck at 165/25/165. I used the exact code you have me in the solution I have marked. Can I know what is wrong with my situation? I am also pretty sure the circuitry is correct.

Pictures for your reference.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/0/d/5/0d53a6604230e8ce99d1dfd6f1ea168a13c38649.jpeg)  
 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/0/c/d/0cd3642da853891aa750b8f66955cb7e3ac4269e.png)

Much appreciated.

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [January 2, 2023, 6:53am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/26 "2023-01-02T06:53:19Z")

</div>

changing the comport between connected devcis is very normal. The comport number does not depend in the USB-port. It depends on some internal device-ID of the USB-to-TTL-chip

The fact that your serial monitor shows the correct characters like "Current Daten & Time" and sometimes strange characters is a hint on **bad** signal quality. Or a may a slightly uncorrect baudrate.

You are using a breadboard inside your lamp. Breadboards are for prototyping but not for longterm use. It might be that there is bad contact somewhere. That would explain the wrong numbers in time and date. I2C is the abbreviation for intercircuit-circuit-communication.  
I2C was developed to interchange data on **short** distances across **PCB-tracks** If normal wires are too long the signals gets too much bended and the communication no longer works.

But sometimes correct characters, sometime bad characters on the serial monitor?

In your lamp are you using arduino IO-ins 0 and IO-pin 1 for anything?  
These are the two IO-pins that are used for the serial communication.  
You should keep away anything else from IO-pins 0 and 1.  
Keep IO-pins 0,1 **free**.

What kind of a lamp ist this? What voltage ? what current?

If you look at the baudrate of the serial monitor what is it adjusted to?

If you look at the baurate inside of **exact** that code that you have **really** uploaded into the Lamp-Arduino what is written there?

```cpp
void setup() {
  Serial.begin(9600);
  delay(3000); // wait for console opening

```

What is shown in the serial monitor if you upload a very simple code that does nothing more than just printing "Hello World" to the serial monitor?

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 3, 2023, 12:47am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/27 "2023-01-03T00:47:13Z")

</div>

Hi @StefanL38 , here is some information for your analysis.  
The baud rate (9600, no line ending) is correct, I have triple checked. The lamp operates from a 12V power source, and the circuit is managed by transistors. Below is the circuit diagram.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/0/0/0/000654734b1dd469352e62838262a68e64b515dc.jpeg)  
The circuit by itself works well, when I used the delay function. In this case, I have not yet integrated the RTC with the circuit. I just connected the RTC to the breadboard and Arduino board, separately from the circuitry of the lamp. I just wanted to see if the RTC functions with this Arduino board too, but as you know, the strange characters showed up. Pins 1 and 0 are kept free. When I tried to print "Hello World," the system replies that "serial does not type a name". When I tried to input the code you gave me for the RTC, it says "the selected serial port does not exist, and you're board is not connected,".

Hope you can sort through this for me, thank you.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [January 3, 2023, 1:06am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/28 "2023-01-03T01:06:24Z")

</div>

> [@arshath786](#):
>
> the system replies that "serial does not type a name"

Did you mean, "Serial does not name a type"?

This is why we request that you copy and paste the entire message instead of paraphrasing it.

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 3, 2023, 7:39am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/29 "2023-01-03T07:39:47Z")

</div>

Yes my bad, sorry

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [January 3, 2023, 8:06am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/30 "2023-01-03T08:06:00Z")

</div>

person: calling a doctor on the phone "doctor make me feel good again"

doctor: what kind of problems do you have?

person: I feel pains

doctor: where do you feel pain

person below

doctor below what?

Do you get it? From this poor information it is impossible to really help.

> [@arshath786](#):
>
> When I tried to input the code you gave me for the RTC, it says "the selected serial port does not exist, and you're board is not connected,".

You seem to have difficulties withe connecting your board.

Now your information is not that poor but your posting is still missing important information

> [@If you get a compiler-error or an upload-error provide all details for analysing the error](https://forum.arduino.cc/t/if-you-get-a-compiler-error-provide-all-details-for-analysing-the-error/971255):
>
> Hi newcomer, the Arduino-Forum community can be of great help. If the community is able to support you in a way that helps solving your problems depends on detailed information that you should provide. trying to be quick by posting a too short posting is just slowing down finding the solution. Because all that happends is that you are asked for the detailed information and have to provide it anyway. Only difference the answer and the solution comes later The most important thing is to post …

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 3, 2023, 11:04am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/31 "2023-01-03T11:04:40Z")

</div>

Really sorry about that Stefan.

Here's the error code.

```cpp
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_184798 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_184798 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino

Using board 'mega' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Using core 'arduino' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Alternatives for uRTCLib.h: [uRTCLib@6.6.0]

ResolveLibrary(uRTCLib.h)

  -> candidates: [uRTCLib@6.6.0]

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Alternatives for Wire.h: [Wire@1.0]

ResolveLibrary(Wire.h)

  -> candidates: [Wire@1.0]

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\uRTCLib\src\uRTCLib.cpp

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\Wire.cpp

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility\twi.c

Generating function prototypes...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\preproc\\ctags_target_for_gcc_minus_e.cpp"

"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\preproc\\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp.o"

Compiling libraries...

Compiling library "uRTCLib"

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\uRTCLib\uRTCLib.cpp.o

Compiling library "Wire"

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\Wire\Wire.cpp.o

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\Wire\utility\twi.c.o

Compiling core...

Using precompiled core: C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787\core\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a

Linking everything together...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\uRTCLib\\uRTCLib.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/..\\arduino_cache_15787\\core\\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a" "-LC:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798" -lm

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.eep"

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.hex"

Using library uRTCLib at version 6.6.0 in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\uRTCLib 

Using library Wire at version 1.0 in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire 

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf"

Sketch uses 6972 bytes (2%) of program storage space. Maximum is 253952 bytes.

Global variables use 637 bytes (7%) of dynamic memory, leaving 7555 bytes for local variables. Maximum is 8192 bytes.

An error occurred while uploading the sketch

C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM7 -b115200 -D -Uflash:w:C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:i 

avrdude: Version 6.3-20190619

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : COM7

         Using Programmer : wiring

         Overriding Baud Rate : 115200

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\Reading_Voltages: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\Reading_Voltages

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_feb17a: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_feb17a

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_mar27a: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_mar27a

         AVR Part : ATmega2560

         Chip Erase delay : 9000 us

         PAGEL : PD7

         BS2 : PA0

         RESET disposition : dedicated

         RETRY pulse : SCK

         serial program mode : yes

         parallel program mode : yes

         Timeout : 200

         StabDelay : 100

         CmdexeDelay : 25

         SyncLoops : 32

         ByteDelay : 0

         PollIndex : 3

         PollValue : 0x53

         Memory Detail :

                                  Block Poll Page Polled

           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00

           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00

           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : Wiring

         Description : Wiring

         Programmer Model: AVRISP

         Hardware Version: 15

         Firmware Version Master : 2.10

         Vtarget : 0.0 V

         SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)

avrdude: reading input file "C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex"

avrdude: writing flash (6972 bytes):

Writing | ################################################## | 100% 1.06s

avrdude: 6972 bytes of flash written

avrdude: verifying flash memory against C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:

avrdude: load data flash data from input file C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:

avrdude: input file C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex contains 6972 bytes

avrdude: reading on-chip flash data:

Reading | #################Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_184798 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_184798 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino

Using board 'mega' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Using core 'arduino' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Alternatives for uRTCLib.h: [uRTCLib@6.6.0]

ResolveLibrary(uRTCLib.h)

  -> candidates: [uRTCLib@6.6.0]

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Alternatives for Wire.h: [Wire@1.0]

ResolveLibrary(Wire.h)

  -> candidates: [Wire@1.0]

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o nul

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\uRTCLib\src\uRTCLib.cpp

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\Wire.cpp

Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility\twi.c

Generating function prototypes...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\preproc\\ctags_target_for_gcc_minus_e.cpp"

"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\preproc\\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp.o"

Compiling libraries...

Compiling library "uRTCLib"

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\uRTCLib\uRTCLib.cpp.o

Compiling library "Wire"

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\Wire\Wire.cpp.o

Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_184798\libraries\Wire\utility\twi.c.o

Compiling core...

Using precompiled core: C:\Users\mdars\AppData\Local\Temp\arduino_cache_15787\core\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a

Linking everything together...

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\sketch\\idkddk.ino.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\uRTCLib\\uRTCLib.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/..\\arduino_cache_15787\\core\\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a" "-LC:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798" -lm

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.eep"

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.hex"

Using library uRTCLib at version 6.6.0 in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\uRTCLib 

Using library Wire at version 1.0 in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire 

"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_184798/idkddk.ino.elf"

Sketch uses 6972 bytes (2%) of program storage space. Maximum is 253952 bytes.

Global variables use 637 bytes (7%) of dynamic memory, leaving 7555 bytes for local variables. Maximum is 8192 bytes.

An error occurred while uploading the sketch

C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM7 -b115200 -D -Uflash:w:C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:i 

avrdude: Version 6.3-20190619

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : COM7

         Using Programmer : wiring

         Overriding Baud Rate : 115200

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\Reading_Voltages: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\Reading_Voltages

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_feb17a: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_feb17a

Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_mar27a: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\sketch_mar27a

         AVR Part : ATmega2560

         Chip Erase delay : 9000 us

         PAGEL : PD7

         BS2 : PA0

         RESET disposition : dedicated

         RETRY pulse : SCK

         serial program mode : yes

         parallel program mode : yes

         Timeout : 200

         StabDelay : 100

         CmdexeDelay : 25

         SyncLoops : 32

         ByteDelay : 0

         PollIndex : 3

         PollValue : 0x53

         Memory Detail :

                                  Block Poll Page Polled

           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00

           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00

           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00

           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : Wiring

         Description : Wiring

         Programmer Model: AVRISP

         Hardware Version: 15

         Firmware Version Master : 2.10

         Vtarget : 0.0 V

         SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)

avrdude: reading input file "C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex"

avrdude: writing flash (6972 bytes):

Writing | ################################################## | 100% 1.06s

avrdude: 6972 bytes of flash written

avrdude: verifying flash memory against C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:

avrdude: load data flash data from input file C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex:

avrdude: input file C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex contains 6972 bytes

avrdude: reading on-chip flash data:

Reading | #################

```

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [January 3, 2023, 11:30am UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/32 "2023-01-03T11:30:33Z")

</div>

```arduino
Invalid library found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum: no headers files (.h) found in C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\libraries\BareMinimum

```

you shouldn't use a **onedrive** drive you should use a **local**  **non** -onedrive-drive

```arduino
         AVR Part : ATmega2560

```

Your arduino-IDE seems to be adjusted for arduino **Mega 2560**  
your pcitures show a Arduino **Uno** which is a diffent board and must be chosen as the board

But I'm not really sure I can't see it from your picture.

All in all the lines you have posted as a whole don't make sense to me

please do the following

- close the arduino-IDE  
-reopen the Arduino-IDE

load **one single** sketch  
click compile and upload

and if the compiling/uploading-process aborts

## immidiately

click copy error-messages  
then post this logfile as a code-section

A successful upload to Arduino Mega 2560 looks like this

```arduino
E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\arduino-builder -dump-prefs -logger=machine -hardware E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\hardware -hardware C:\Users\dipl-\AppData\Local\Arduino15\packages -tools E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\tools-builder -tools E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\hardware\tools\avr -tools C:\Users\dipl-\AppData\Local\Arduino15\packages -built-in-libraries E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries -libraries F:\myData\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484 -warnings=all -build-cache C:\Users\dipl-\AppData\Local\Temp\arduino_cache_552399 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose F:\myData\Arduino\Test-Upload-to-Ardiuno-Mega-002\Test-Upload-to-Ardiuno-Mega-002.ino
E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\arduino-builder -compile -logger=machine -hardware E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\hardware -hardware C:\Users\dipl-\AppData\Local\Arduino15\packages -tools E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\tools-builder -tools E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\hardware\tools\avr -tools C:\Users\dipl-\AppData\Local\Arduino15\packages -built-in-libraries E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries -libraries F:\myData\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484 -warnings=all -build-cache C:\Users\dipl-\AppData\Local\Temp\arduino_cache_552399 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose F:\myData\Arduino\Test-Upload-to-Ardiuno-Mega-002\Test-Upload-to-Ardiuno-Mega-002.ino
Using board 'mega' from platform in folder: C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp" -o nul
Alternatives for uRTCLib.h: [uRTCLib@6.6.0]
ResolveLibrary(uRTCLib.h)
  -> candidates: [uRTCLib@6.6.0]
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp" -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
  -> candidates: [Wire@1.0]
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp" -o nul
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "F:\\myData\\Arduino\\libraries\\uRTCLib\\src\\uRTCLib.cpp" -o nul
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src\\Wire.cpp" -o nul
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src\\utility\\twi.c" -o nul
Generating function prototypes...
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp" -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"E:\\Arduino-funktioniert\\arduino-1.8.19-windows-2022-01-30\\arduino-1.8.19\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert...
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp" -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp.o"
Compiling libraries...
Compiling library "uRTCLib"
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "F:\\myData\\Arduino\\libraries\\uRTCLib\\src\\uRTCLib.cpp" -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\uRTCLib\\uRTCLib.cpp.o"
Compiling library "Wire"
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src\\Wire.cpp" -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\Wire\\Wire.cpp.o"
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -c -g -Os -Wall -Wextra -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-IF:\\myData\\Arduino\\libraries\\uRTCLib\\src" "-IC:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src\\utility\\twi.c" -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\Wire\\utility\\twi.c.o"
Compiling core...
Using precompiled core: C:\Users\dipl-\AppData\Local\Temp\arduino_cache_552399\core\core_arduino_avr_mega_cpu_atmega2560_cbf59aea3d48275ca0a46a930fe90002.a
Linking everything together...
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.elf" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\sketch\\Test-Upload-to-Ardiuno-Mega-002.ino.cpp.o" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\uRTCLib\\uRTCLib.cpp.o" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/..\\arduino_cache_552399\\core\\core_arduino_avr_mega_cpu_atmega2560_cbf59aea3d48275ca0a46a930fe90002.a" "-LC:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484" -lm
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.elf" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.eep"
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.elf" "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex"
Bibliothek uRTCLib in Version 6.6.0 im Ordner: F:\myData\Arduino\libraries\uRTCLib wird verwendet
Bibliothek Wire in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire wird verwendet
"C:\\Users\\dipl-\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\dipl-\\AppData\\Local\\Temp\\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.elf"
Der Sketch verwendet 7060 Bytes (2%) des Programmspeicherplatzes. Das Maximum sind 253952 Bytes.
Globale Variablen verwenden 593 Bytes (7%) des dynamischen Speichers, 7599 Bytes für lokale Variablen verbleiben. Das Maximum sind 8192 Bytes.
C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM20 -b115200 -D -Uflash:w:C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : COM20
         Using Programmer : wiring
         Overriding Baud Rate : 115200
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : Wiring
         Description : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget : 0.0 V
         SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex"
avrdude: writing flash (7060 bytes):

Writing | ################################################## | 100% 1.08s

avrdude: 7060 bytes of flash written
avrdude: verifying flash memory against C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex:
avrdude: load data flash data from input file C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex:
avrdude: input file C:\Users\dipl-\AppData\Local\Temp\arduino_build_3484/Test-Upload-to-Ardiuno-Mega-002.ino.hex contains 7060 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.84s

avrdude: verifying ...
avrdude: 7060 bytes of flash verified

avrdude done. Thank you.

```

Your upload stops in the middle of the reading

```arduino
.....
avrdude: input file C:\Users\mdars\AppData\Local\Temp\arduino_build_184798/idkddk.ino.hex contains 6972 bytes

avrdude: reading on-chip flash data:

Reading | #################

```

I supsect a bad USB-cable or insufficient power-supply.

You are using 100 Ohm resistors as base-resistors  
This is a pretty low value  
5V / 100 Ohm = 0,05A = 50 mA  
An IO-pin can draw a maximum of 40 mA. And you should stay below 20 mA if ever possible.

A base-current of 10 mA should be plenty enough to drive your LEDs  
Though this must be checked inside the datasheet

10mA means: 5V = 0,010A = 500 Ohm.

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 3, 2023, 12:14pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/33 "2023-01-03T12:14:44Z")

</div>

@StefanL38 The problem is not the Lamp circuit, because it works fine by its own. I'm separating the circuitry of the lamp and the RTC, and I just tested the RTC by itself to see if it functions. This time when I tried what you said, there was no error stated, but there were many red lines in the messages. Sorry to keep troubling you.

```cpp
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries D:\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_246695 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_658629 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware -hardware C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86 __mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__ mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries -libraries D:\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=1A86_7523 -ide-version=10819 -build-path C:\Users\mdars\AppData\Local\Temp\arduino_build_246695 -warnings=all -build-cache C:\Users\mdars\AppData\Local\Temp\arduino_cache_658629 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -verbose C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\Arduino\idkddk\idkddk.ino
Using board 'mega' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp" -o nul
Alternatives for uRTCLib.h: [uRTCLib@6.6.0]
ResolveLibrary(uRTCLib.h)
  -> candidates: [uRTCLib@6.6.0]
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-ID:\\libraries\\uRTCLib\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp" -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
  -> candidates: [Wire@1.0]
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-ID:\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp" -o nul
Using cached library dependencies for file: D:\libraries\uRTCLib\src\uRTCLib.cpp
Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\Wire.cpp
Using cached library dependencies for file: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility\twi.c
Generating function prototypes...
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-ID:\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\mega" "-ID:\\libraries\\uRTCLib\\src" "-IC:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp" -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp.o"
Compiling libraries...
Compiling library "uRTCLib"
Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_246695\libraries\uRTCLib\uRTCLib.cpp.o
Compiling library "Wire"
Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_246695\libraries\Wire\Wire.cpp.o
Using previously compiled file: C:\Users\mdars\AppData\Local\Temp\arduino_build_246695\libraries\Wire\utility\twi.c.o
Compiling core...
Using precompiled core: C:\Users\mdars\AppData\Local\Temp\arduino_cache_658629\core\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a
Linking everything together...
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\sketch\\idkddk.ino.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\libraries\\uRTCLib\\uRTCLib.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/..\\arduino_cache_658629\\core\\core_arduino_avr_mega_cpu_atmega2560_c3300dc54b2ee5473b54566b6921cb45.a" "-LC:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695" -lm
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.eep"
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.elf" "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.hex"
Using library uRTCLib at version 6.6.0 in folder: D:\libraries\uRTCLib 
Using library Wire at version 1.0 in folder: C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\hardware\avr\1.8.6\libraries\Wire 
"C:\\Users\\mdars\\OneDrive - Anglo-Chinese School (Independent)\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\mdars\\AppData\\Local\\Temp\\arduino_build_246695/idkddk.ino.elf"
Sketch uses 6972 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 637 bytes (7%) of dynamic memory, leaving 7555 bytes for local variables. Maximum is 8192 bytes.
C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM7 -b115200 -D -Uflash:w:C:\Users\mdars\AppData\Local\Temp\arduino_build_246695/idkddk.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\mdars\OneDrive - Anglo-Chinese School (Independent)\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : COM7
         Using Programmer : wiring
         Overriding Baud Rate : 115200
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : Wiring
         Description : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget : 0.0 V
         SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\mdars\AppData\Local\Temp\arduino_build_246695/idkddk.ino.hex"
avrdude: writing flash (6972 bytes):

Writing | ################################################## | 100% 1.07s

avrdude: 6972 bytes of flash written
avrdude: verifying flash memory against C:\Users\mdars\AppData\Local\Temp\arduino_build_246695/idkddk.ino.hex:
avrdude: load data flash data from input file C:\Users\mdars\AppData\Local\Temp\arduino_build_246695/idkddk.ino.hex:
avrdude: input file C:\Users\mdars\AppData\Local\Temp\arduino_build_246695/idkddk.ino.hex contains 6972 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.82s

avrdude: verifying ...
avrdude: 6972 bytes of flash verified

avrdude done. Thank you.

```

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [January 3, 2023, 12:40pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/34 "2023-01-03T12:40:14Z")

</div>

it is normal that the AVRdude-log (= the upload-to-flash-process is printed in red

```cpp
avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\dipl-\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port : COM20
         Using Programmer : wiring
         Overriding Baud Rate : 115200
         AVR Part : ATmega2560
         Chip Erase delay : 9000 us
         PAGEL : PD7
         BS2 : PA0
         RESET disposition : dedicated
         RETRY pulse : SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout : 200
         StabDelay : 100
         CmdexeDelay : 25
         SyncLoops : 32
         ByteDelay : 0
         PollIndex : 3
         PollValue : 0x53
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
           flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
           lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
           calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
           signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

         Programmer Type : Wiring
         Description : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget : 0.0 V
         SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\dipl-\AppData\Local\Temp\arduino_build_210610/Test-Upload-to-Ardiuno-Mega-002.ino.hex"
avrdude: writing flash (7060 bytes):

Writing | ################################################## | 100% 1.10s

avrdude: 7060 bytes of flash written
avrdude: verifying flash memory against C:\Users\dipl-\AppData\Local\Temp\arduino_build_210610/Test-Upload-to-Ardiuno-Mega-002.ino.hex:
avrdude: load data flash data from input file C:\Users\dipl-\AppData\Local\Temp\arduino_build_210610/Test-Upload-to-Ardiuno-Mega-002.ino.hex:
avrdude: input file C:\Users\dipl-\AppData\Local\Temp\arduino_build_210610/Test-Upload-to-Ardiuno-Mega-002.ino.hex contains 7060 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.84s

avrdude: verifying ...
avrdude: 7060 bytes of flash verified

avrdude done. Thank you.

```

If the log finishes with

```cpp
avrdude: 7060 bytes of flash verified

avrdude done. Thank you.

```

the upload is OK.  
So what is your serial monitor showing?

---

<div class="post-metadata">

**Author:** ![arshath786](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@arshath786](https://forum.arduino.cc/u/arshath786)\
**Post date:** [January 3, 2023, 1:30pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/35 "2023-01-03T13:30:35Z")

</div>

The same garble. I don't know what to do....

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [January 3, 2023, 1:36pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/36 "2023-01-03T13:36:31Z")

</div>

**un** precise information

post the output to the serial monitor as a code-section

did you try a different USB-cable?  
did you try a different computer?  
did you try re-booting your computer?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 2, 2023, 1:37pm UTC](https://forum.arduino.cc/t/code-not-working-as-expected/1071086/37 "2023-07-02T13:37:23Z")

</div>

Closed on July 2, 2023, 1:37pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.arduino.cc/t/code-not-working-as-expected/1071086.md?page=1)
