The Giga R1 WIFI is on the left.  It is the I2C Master.  It has Wifi and RTC clock configured.  The Arduino Mega 2560 is a I2C slave with address 0x15.

variables.py

The Giga R1 Wifi Micropython code uses different pinouts than Arduino pinouts.  I started this file to standardized my code with the Arduino pinout. 

# SSID
username = "xxxx"
spw = "xxxx"

# PINOUT
D52 = "PK2"
D53 = "PG7"

# I2C
D20 = "PB11"
D21 = "PH4"

wifi.py

The Giga R1 Wifi is internet capable.  You see that the username and password are called from variables.py.

import network, variables

class WIFI:
    WIFI_NETWORK = variables.username
    WIFI_PASSWORD = variables.spw
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    wlan.connect(WIFI_NETWORK, WIFI_PASSWORD)

dst.py

This file calibrates the first and last day of daylight savings time. 

March is 2nd Sunday at 2am
November is 1st Sunday at 2am

import ntptime, time

class DST:
    ntptime.settime()
    year = time.localtime()[0]       #get current year
    
    HHMarch = time.mktime((year,3 ,(14-(int(5*year/4+1))%7),2,0,0,0,0,0)) 
    #Time of March change to ESDT
    DST_START = time.localtime(HHMarch)
    print(DST_START)
    
    HHNovember = time.mktime((year,11,(7-(int(5*year/4+1))%7),2,0,0,0,0,0)) 
    #Time of November change to EST
    DST_END = time.localtime(HHNovember)   
    print(DST_END)

blink_test.py

The LED variables are called from variables.py. 

import time
from machine import Pin
import variables
# D53 (Arduino) = PG7 (MicroPython)


class Blynk:
    print("Blink")
    Red_LED = Pin(variables.D52, Pin.OUT)
    Green_LED = Pin(variables.D53, Pin.OUT)
    Red_LED.on()
    time.sleep(1)
    Red_LED.off()
    time.sleep(1)
    Green_LED.on()
    time.sleep(1)
    Green_LED.off()
    time.sleep(1)

main.py

from time import sleep
from wifi import WIFI
from dst import DST
import ntptime, time, variables
from blink_test import Blynk
from i2c import *

devices_found = 0

def wifi_function_once(_has_run=[]):
    a = WIFI()
    if _has_run: 
        return
    print('\n') 
    print("first time")
    print("Connected to ",a.WIFI_NETWORK)
    print(a.wlan)
    wifi_ran = True
    _has_run.append(1)

def I2C_function_once(_has_run=[]):
    if _has_run: 
        for device in devices:
            print("I2C hexadecimal address: ", hex(device))
        print('\n') 
        return
    
    i = I2CScanner()
    print('\n')
    print('I2C SCANNER')
    devices = i.i2c.scan()

    if len(devices) == 0:
        print("No i2c device !")
    else:
        print('i2c devices found:', len(devices))

    for device in devices:
        print("I2C hexadecimal address: ", hex(device))
    
def blynk_function():
    print("Blink")
    Red_LED = Pin(variables.D52, Pin.OUT)
    Green_LED = Pin(variables.D53, Pin.OUT)
    Red_LED.on()
    time.sleep(1)
    Red_LED.off()
    time.sleep(1)
    Green_LED.on()
    time.sleep(1)
    Green_LED.off()
    time.sleep(1)
    return
    
def dst_function(_has_run=[]):
    if _has_run: 
        return
    d = DST()
    print("DST Start: {:02d}/{:02d}/{:02d}".format(d.DST_START[1],d.DST_START[2],d.DST_START[0]))
    print("DST END: {:02d}/{:02d}/{:02d}".format(d.DST_END[1],d.DST_END[2],d.DST_END[0]))

    # Set RTC Clock properly
    now=time.time()   
    if now < d.HHMarch :               # we are before last sunday of march
        EST_TIME = time.localtime(now-18000) # EST:  UTC-5H is 5 * 36000
        hour_number = EST_TIME[3]
        if hour_number < 13:
            hour_12 = hour_number
            am_pm = 'am'
        else:
            hour_12 = hour_number - 12
            am_pm = 'pm'    
    
        print("Today's Date: {:02d}/{:02d}/{:02d}".format(EST_TIME[1],EST_TIME[2],EST_TIME[0]))
        print("Time: {:02d}:{:02d}:{:02d} {}".format(hour_12,EST_TIME[4],EST_TIME[5],am_pm))
        
    
    elif now < d.HHNovember :               # we are before last sunday of march
        
        EST_TIME = time.localtime(now-14400) # EDST:  UTC-4H    4 * 3600
        hour_number = EST_TIME[3]
        if hour_number < 13:
            hour_12 = hour_number
            am_pm = 'am'
        else:
            hour_12 = hour_number - 12
            am_pm = 'pm'    
    
        print("Today's Date: {:02d}/{:02d}/{:04d}".format(EST_TIME[1],EST_TIME[2],EST_TIME[0]))
        print("Time: {:02d}:{:02d}:{:02d} {}".format(hour_12,EST_TIME[4],EST_TIME[5],am_pm))
    
    else :
        EST_TIME = time.localtime(now-18000) # EST:  UTC-5H is 5 * 3600
        hour_number = EST_TIME[3]
        if hour_number < 13:
            hour_12 = hour_number
            am_pm = 'am'
        else:
            hour_12 = hour_number - 12
            am_pm = 'pm'    
    
        print("Today's Date: {:02d}/{:02d}/{:02d}".format(EST_TIME[1],EST_TIME[2],EST_TIME[0]))
        print("Time: {:02d}:{:02d}:{:02d} {}".format(hour_12,EST_TIME[4],EST_TIME[5],am_pm))
            


if __name__=="__main__":
    while True:
        dst_function()
        wifi_function_once()
        I2C_function_once()   
        blynk_function()
        sleep(3)
    
    
    

Output of main.py

DST Start: 03/10/2024
DST END: 11/03/2024
Today's Date: 04/14/2024
Time: 07:27:08 pm


I2C SCANNER
i2c devices found: 1
I2C hexadecimal address:  0x15
Blink