import RPi.GPIO as GPIO
import datetime
import time
# Version 1.1 17.01.2021
GPIO.setmode(GPIO.BCM)
D1_pin = 6
D2_pin = 5
D3_pin = 26
D4_pin = 19
D5_pin = 24
D6_pin = 25
D7_pin = 23
D8_pin = 13
CLK1_pin = 12
CLK2_pin = 16
CLK3_pin = 20
CLK4_pin = 21
OE_pin = 22
GPIO.setwarnings(False)
GPIO.setup(D1_pin, GPIO.OUT)
GPIO.setup(D2_pin, GPIO.OUT)
GPIO.setup(D3_pin, GPIO.OUT)
GPIO.setup(D4_pin, GPIO.OUT)
GPIO.setup(D5_pin, GPIO.OUT)
GPIO.setup(D6_pin, GPIO.OUT)
GPIO.setup(D7_pin, GPIO.OUT)
GPIO.setup(D8_pin, GPIO.OUT)
GPIO.setup(CLK1_pin, GPIO.OUT)
GPIO.setup(CLK2_pin, GPIO.OUT)
GPIO.setup(CLK3_pin, GPIO.OUT)
GPIO.setup(CLK4_pin, GPIO.OUT)
GPIO.setup(OE_pin, GPIO.OUT)
def disable_all_gpio():
GPIO.output(OE_pin, True)
print("Alle Ausgänge sind hochohmig")
def enable_all_gpio():
GPIO.output(OE_pin, False)
print("Alle Ausgänge sind aktiv")
def CLock1_gpio():
GPIO.output(CLK1_pin, False)
GPIO.output(CLK1_pin, True)
GPIO.output(CLK1_pin, False)
def CLock2_gpio():
GPIO.output(CLK2_pin, False)
GPIO.output(CLK2_pin, True)
GPIO.output(CLK2_pin, False)
def CLock3_gpio():
GPIO.output(CLK3_pin, False)
GPIO.output(CLK3_pin, True)
GPIO.output(CLK3_pin, False)
def CLock4_gpio():
GPIO.output(CLK4_pin, False)
GPIO.output(CLK4_pin, True)
GPIO.output(CLK4_pin, False)
def Lima_Tag():
GPIO.output(D1_pin, False)
GPIO.output(D2_pin, True)
def Lima_Nacht():
GPIO.output(D1_pin, True)
GPIO.output(D2_pin, False)
def San_Francisco_Tag():
GPIO.output(D3_pin, False)
GPIO.output(D4_pin, True)
def San_Francisco_Nacht():
GPIO.output(D3_pin, True)
GPIO.output(D4_pin, False)
def Papeete_Tag():
GPIO.output(D5_pin, False)
GPIO.output(D6_pin, True)
def Papeete_Nacht():
GPIO.output(D5_pin, True)
GPIO.output(D6_pin, False)
def Honolulu_Tag():
GPIO.output(D7_pin, False)
GPIO.output(D8_pin, True)
def Honolulu_Nacht():
GPIO.output(D7_pin, True)
GPIO.output(D8_pin, False)
def Cape_Town_Tag():
GPIO.output(D1_pin, False)
GPIO.output(D2_pin, True)
def Cape_Town_Nacht():
GPIO.output(D1_pin, True)
GPIO.output(D2_pin, False)
def Bolzano_Tag():
GPIO.output(D3_pin, False)
GPIO.output(D4_pin, True)
def Bolzano_Nacht():
GPIO.output(D3_pin, True)
GPIO.output(D4_pin, False)
def Funchal_Tag():
GPIO.output(D5_pin, False)
GPIO.output(D6_pin, True)
def Funchal_Nacht():
GPIO.output(D5_pin, True)
GPIO.output(D6_pin, False)
def Toronto_Tag():
GPIO.output(D7_pin, False)
GPIO.output(D8_pin, True)
def Toronto_Nacht():
GPIO.output(D7_pin, True)
GPIO.output(D8_pin, False)
def Perth_Tag():
GPIO.output(D1_pin, False)
GPIO.output(D2_pin, True)
def Perth_Nacht():
GPIO.output(D1_pin, True)
GPIO.output(D2_pin, False)
def Singapur_Tag():
GPIO.output(D3_pin, False)
GPIO.output(D4_pin, True)
def Singapur_Nacht():
GPIO.output(D3_pin, True)
GPIO.output(D4_pin, False)
def Dubai_Tag():
GPIO.output(D5_pin, False)
GPIO.output(D6_pin, True)
def Dubai_Nacht():
GPIO.output(D5_pin, True)
GPIO.output(D6_pin, False)
def Larnaca_Tag():
GPIO.output(D7_pin, False)
GPIO.output(D8_pin, True)
def Larnaca_Nacht():
GPIO.output(D7_pin, True)
GPIO.output(D8_pin, False)
def Auckland_Tag():
GPIO.output(D1_pin, False)
GPIO.output(D2_pin, True)
def Auckland_Nacht():
GPIO.output(D1_pin, True)
GPIO.output(D2_pin, False)
def Sydney_Tag():
GPIO.output(D3_pin, False)
GPIO.output(D4_pin, True)
def Sydney_Nacht():
GPIO.output(D3_pin, True)
GPIO.output(D4_pin, False)
def Hobart_Tag():
GPIO.output(D5_pin, False)
GPIO.output(D6_pin, True)
def Hobart_Nacht():
GPIO.output(D5_pin, True)
GPIO.output(D6_pin, False)
def Darwin_Tag():
GPIO.output(D7_pin, False)
GPIO.output(D8_pin, True)
def Darwin_Nacht():
GPIO.output(D7_pin, True)
GPIO.output(D8_pin, False)
# Sonnenauf- und Sonnenuntergang pro KW in Minute
Sydney=(351,1208,357,1208,363,1206,370,1203,377,1199,384,1193,391,1186,397,1179,403,1170,409,1161,415,1152,420,1142,425,1133,371,1064,376,1055,381,1046,386,1038,392,1031,397,1025,402,1020,407,1016,411,1013,415,1012,418,1012,420,1013,421,1015,421,1018,419,1021,417,1026,413,1030,407,1035,401,1040,394,1045,386,1050,377,1054,368,1059,358,1064,348,1069,339,1073,389,1138,380,1144,371,1149,363,1155,356,1161,349,1168,344,1175,341,1181,338,1188,338,1194,339,1199,341,1203,345,1206)
Perth=(317,1165,323,1165,329,1164,336,1161,342,1157,349,1151,355,1145,361,1138,367,1130,372,1122,377,1113,382,1104,386,1095,391,1086,396,1078,401,1070,405,1062,410,1056,415,1050,420,1045,424,1042,428,1039,432,1038,435,1038,437,1039,438,1041,438,1045,437,1047,434,1051,430,1056,425,1060,419,1064,412,1069,405,1073,397,1078,388,1082,379,1086,370,1090,360,1095,351,1099,343,1104,334,1109,327,1114,320,1120,314,1126,310,1132,306,1139,304,1145,304,1150,305,1156,308,1160,311,1163)
Darwin=(387,1155,391,1157,395,1158,398,1158,401,1158,404,1156,406,1154,408,1151,409,1147,410,1143,411,1139,411,1135,412,1130,412,1126,412,1122,413,1118,414,1114,415,1111,416,1109,418,1107,419,1106,421,1106,423,1107,425,1107,427,1109,428,1110,429,1112,429,1114,429,1116,428,1118,426,1119,424,1120,420,1121,417,1121,412,1121,408,1121,403,1121,398,1121,393,1121,389,1121,384,1122,380,1122,377,1124,374,1125,372,1128,371,1130,371,1134,372,1137,373,1141,376,1145,379,1148,382,1152)
Hobart=(339,1251,346,1249,355,1246,364,1240,373,1233,383,1225,392,1216,401,1205,410,1194,419,1182,428,1170,436,1158,444,1145,392,1073,400,1062,408,1050,416,1040,423,1030,431,1022,438,1015,445,1009,451,1004,456,1002,460,1001,462,1002,463,1004,462,1008,459,1013,455,1018,449,1025,442,1032,433,1039,423,1046,413,1054,401,1061,389,1069,377,1076,364,1084,352,1091,400,1159,387,1167,376,1176,365,1184,355,1193,346,1202,339,1211,333,1220,329,1229,327,1236,326,1242,328,1247,332,1250)
Honolulu=(431,1082,432,1087,432,1091,431,1096,429,1100,426,1105,422,1108,417,1112,412,1115,406,1117,400,1120,394,1122,385,1125,381,1126,375,1128,369,1131,364,1133,360,1136,356,1139,353,1142,351,1145,350,1148,349,1151,350,1153,351,1155,353,1156,355,1156,358,1155,361,1154,363,1151,354,1156,357,1156,359,1155,362,1153,365,1150,377,1121,379,1097,380,1108,382,1101,384,1094,386,1089,389,1083,392,1078,395,1074,399,1070,403,1068,407,1067,412,1067,416,1068,421,1070,425,1073,428,1077)
Papeete=(330,1116,334,1118,339,1118,343,1117,347,1116,350,1113,353,1110,356,1106,358,1101,360,1096,362,1091,363,1085,364,1080,366,1074,367,1069,369,1064,371,1060,373,1056,375,1053,377,1051,380,1050,382,1049,384,1049,386,1050,388,1051,389,1053,390,1055,390,1057,389,1060,387,1062,384,1064,381,1066,377,1067,372,1069,367,1070,361,1071,355,1072,350,1073,344,1074,338,1075,333,1076,328,1078,323,1080,320,1083,317,1086,315,1090,315,1094,315,1098,316,1102,318,1106,321,1110,325,1113)
SanFrancisco=(445,1021,445,1030,443,1037,439,1045,434,1052,427,1060,419,1068,410,1075,401,1082,391,1089,441,1156,430,1162,419,1169,409,1175,399,1181,389,1188,380,1194,372,1201,365,1207,359,1213,354,1219,350,1224,348,1228,348,1231,349,1233,351,1234,354,1233,359,1231,364,1227,369,1222,375,1215,381,1208,387,1199,393,1190,399,1180,405,1169,411,1158,417,1148,423,1138,429,1126,435,1116,442,1106,449,1097,456,1089,403,1022,411,1017,418,1013,425,1010,431,1009,437,1010,441,1013,444,1017)
Lima=(350,1116,353,1118,357,1119,361,1119,364,1119,366,1117,368,1115,370,1112,371,1108,372,1104,372,1100,373,1096,373,1091,373,1087,373,1083,374,1079,375,1076,376,1073,377,1071,379,1069,380,1069,382,1068,384,1069,386,1070,388,1071,389,1073,390,1075,390,1077,390,1078,389,1080,387,1081,384,1082,381,1083,377,1083,373,1083,369,1083,364,1083,359,1083,355,1082,350,1083,346,1083,342,1084,339,1085,336,1087,334,1089,333,1091,333,1095,334,1098,336,1102,338,1106,341,1109,345,1113)
Toronto=(472,1013,470,1021,467,1029,461,1038,454,1048,446,1057,436,1067,426,1076,414,1085,402,1094,450,1163,437,1171,425,1180,412,1188,400,1196,388,1205,377,1213,367,1221,358,1229,351,1237,345,1244,340,1250,337,1255,336,1259,337,1261,339,1262,343,1260,348,1257,354,1252,361,1245,369,1236,376,1228,384,1218,392,1206,400,1195,408,1182,416,1169,423,1157,431,1144,440,1131,448,1119,456,1107,465,1097,474,1087,423,1018,433,1011,441,1005,450,1001,457,999,463,1000,468,1002,471,1006)
Funchal=(491,1094,491,1100,489,1106,487,1113,482,1119,477,1126,471,1132,464,1138,456,1144,447,1149,438,1154,429,1159,476,1226,471,1229,462,1234,454,1239,446,1244,439,1249,433,1254,428,1259,424,1264,422,1268,420,1272,420,1275,421,1277,423,1278,426,1277,430,1276,434,1273,438,1268,443,1263,448,1257,453,1250,457,1242,462,1233,466,1224,471,1215,475,1205,480,1196,484,1187,489,1178,495,1170,500,1162,446,1095,452,1090,458,1085,464,1082,470,1080,476,1080,481,1081,485,1084,489,1088)
CapeTown=(342,1200,348,1199,355,1198,362,1194,369,1190,376,1184,382,1177,389,1169,395,1161,401,1152,406,1143,412,1133,417,1124,422,1114,427,1105,433,1097,438,1089,443,1082,448,1076,453,1071,458,1067,463,1064,467,1063,470,1063,472,1064,473,1066,472,1069,471,1073,468,1077,464,1081,458,1086,452,1091,444,1096,436,1101,428,1106,418,1110,409,1115,399,1120,389,1125,380,1130,370,1135,362,1141,354,1147,346,1153,340,1160,335,1166,331,1173,329,1179,329,1185,330,1191,332,1195,336,1198)
Larnaca=(414,1004,414,1012,412,1019,409,1026,404,1033,399,1040,392,1047,384,1053,375,1060,366,1066,357,1072,347,1077,397,1143,387,1148,378,1154,369,1160,361,1165,353,1171,347,1176,341,1182,337,1187,334,1192,332,1196,332,1199,333,1201,335,1202,338,1201,342,1199,346,1196,351,1191,356,1186,362,1179,367,1171,372,1162,377,1153,382,1144,387,1134,393,1124,398,1114,403,1104,408,1094,414,1085,420,1077,367,1010,373,1004,380,999,387,995,393,993,399,992,405,994,409,996,412,1000)
Dubai=(426,1061,427,1066,426,1072,425,1077,422,1082,419,1087,414,1091,408,1096,402,1099,396,1103,389,1106,381,1109,374,1113,367,1116,360,1119,353,1122,347,1125,342,1129,337,1132,334,1136,331,1140,329,1143,329,1146,329,1149,330,1150,332,1151,334,1152,337,1151,340,1149,344,1146,347,1142,350,1137,354,1131,357,1125,359,1118,362,1111,365,1104,367,1096,370,1088,373,1081,376,1074,379,1068,383,1062,387,1057,391,1053,396,1049,401,1048,406,1047,411,1048,416,1049,420,1052,423,1056)
Singapur=(428,1150,431,1153,434,1155,436,1157,437,1159,437,1159,437,1159,436,1159,435,1158,433,1157,431,1155,429,1153,426,1151,424,1150,422,1148,420,1147,418,1146,417,1145,416,1145,416,1145,416,1146,417,1147,418,1148,419,1149,421,1151,422,1152,424,1154,425,1154,426,1155,426,1155,426,1155,426,1154,425,1152,423,1150,422,1148,420,1145,417,1143,415,1140,413,1137,411,1135,409,1133,408,1131,407,1129,407,1129,407,1129,408,1130,409,1131,412,1133,415,1136,418,1139,421,1142,425,1146)
Auckland=(368,1242,375,1242,382,1239,389,1236,397,1230,405,1224,412,1216,419,1208,426,1198,433,1189,440,1179,446,1168,452,1158,398,1088,404,1078,410,1069,416,1060,422,1052,428,1045,434,1039,439,1035,444,1032,449,1030,452,1029,454,1030,455,1032,455,1036,453,1040,449,1044,445,1050,439,1055,432,1061,424,1066,415,1072,405,1077,395,1083,385,1088,374,1094,424,1160,413,1166,403,1172,394,1178,385,1185,377,1192,370,1199,364,1207,359,1214,357,1221,355,1228,356,1233,358,1237,362,1241)
Bolzano=(479,1000,477,1008,472,1017,466,1027,458,1038,449,1048,438,1059,427,1069,414,1079,401,1089,388,1099,374,1109,420,1178,407,1188,394,1197,381,1206,369,1216,358,1225,348,1234,339,1243,332,1250,327,1257,323,1263,322,1267,323,1269,325,1270,329,1268,335,1264,342,1259,349,1251,358,1242,366,1232,375,1221,384,1209,393,1196,402,1182,411,1169,420,1155,429,1141,438,1127,447,1114,457,1101,467,1089,417,1018,427,1008,437,1000,447,994,456,989,464,987,470,986,475,988,478,993)
def leds_an_aus():
Bolzano_Zeit=(x.hour)*60+x.minute #+1
if Bolzano_Zeit>1439:
Bolzano_Zeit=Bolzano_Zeit-1439
Sydney_Zeit=(x.hour+10)*60+x.minute #+10
if Sydney_Zeit>1439:
Sydney_Zeit=Sydney_Zeit-1439
Perth_Zeit=(x.hour+7)*60+x.minute #+7
if Perth_Zeit>1439:
Perth_Zeit=Perth_Zeit-1439
Darwin_Zeit=(x.hour+8)*60+x.minute+30 #+8:30
if Darwin_Zeit>1439:
Darwin_Zeit=Darwin_Zeit-1439
Hobart_Zeit=(x.hour+10)*60+x.minute #+10
if Hobart_Zeit>1439:
Hobart_Zeit=Hobart_Zeit-1439
Cape_Town_Zeit=(x.hour+2)*60+x.minute #+2
if Cape_Town_Zeit>1439:
Cape_Town_Zeit=Cape_Town_Zeit-1439
Larnaca_Zeit=(x.hour+2)*60+x.minute #+2
if Larnaca_Zeit>1439:
Larnaca_Zeit=Larnaca_Zeit-1439
Dubai_Zeit=(x.hour+4)*60+x.minute #+4
if Dubai_Zeit>1439:
Dubai_Zeit=Dubai_Zeit-1439
Singapur_Zeit=(x.hour+8)*60+x.minute #+8
if Singapur_Zeit>1439:
Singapur_Zeit=Singapur_Zeit-1439
Auckland_Zeit=(x.hour+13)*60+x.minute #+13
if Auckland_Zeit>1439:
Auckland_Zeit=Auckland_Zeit-1439
Honolulu_Zeit=(x.hour+13)*60+x.minute #-10
if Honolulu_Zeit>1439:
Honolulu_Zeit=Honolulu_Zeit-1439
Papeete_Zeit=(x.hour+13)*60+x.minute #-10
if Papeete_Zeit>1439:
Papeete_Zeit=Papeete_Zeit-1439
San_Francisco_Zeit=(x.hour+15)*60+x.minute #-8
if San_Francisco_Zeit>1439:
San_Francisco_Zeit=San_Francisco_Zeit-1439
Lima_Zeit=(x.hour+18)*60+x.minute #-5
if Lima_Zeit>1439:
Lima_Zeit=Lima_Zeit-1439
Toronto_Zeit=(x.hour+18)*60+x.minute #-5
if Toronto_Zeit>1439:
Toronto_Zeit=Toronto_Zeit-1439
Funchal_Zeit=(x.hour+23)*60+x.minute #0
if Funchal_Zeit>1439:
Funchal_Zeit=Funchal_Zeit-1439
# Erste Gruppe mit 4 Städten
if (Honolulu[(kw-1)*2]<Honolulu_Zeit) and (Honolulu[(kw-1)*2+1]>Honolulu_Zeit):
Honolulu_Tag()
else:
Honolulu_Nacht()
if (Papeete[(kw-1)*2]<Papeete_Zeit) and (Papeete[(kw-1)*2+1]>Papeete_Zeit):
Papeete_Tag()
else:
Papeete_Nacht()
if (SanFrancisco[(kw-1)*2]<San_Francisco_Zeit) and (SanFrancisco[(kw-1)*2+1]>San_Francisco_Zeit):
San_Francisco_Tag()
else:
San_Francisco_Nacht()
if (Lima[(kw-1)*2]<Lima_Zeit) and (Lima[(kw-1)*2+1]>Lima_Zeit):
Lima_Tag()
else:
Lima_Nacht()
CLock1_gpio()
# Zweite Gruppe mit 4 Städten
if (Toronto[(kw-1)*2]<Toronto_Zeit) and (Toronto[(kw-1)*2+1]>Toronto_Zeit):
Toronto_Tag()
else:
Toronto_Nacht()
if (Funchal[(kw-1)*2]<Funchal_Zeit) and (Funchal[(kw-1)*2+1]>Funchal_Zeit):
Funchal_Tag()
else:
Funchal_Nacht()
if (CapeTown[(kw-1)*2]<Cape_Town_Zeit) and (CapeTown[(kw-1)*2+1]>Cape_Town_Zeit):
Cape_Town_Tag()
else:
Cape_Town_Nacht()
if (Bolzano[(kw-1)*2]<Bolzano_Zeit) and (Bolzano[(kw-1)*2+1]>Bolzano_Zeit):
Bolzano_Tag()
else:
Bolzano_Nacht()
CLock2_gpio()
# Dritte Gruppe mit 4 Städten
if (Larnaca[(kw-1)*2]<Larnaca_Zeit) and (Larnaca[(kw-1)*2+1]>Larnaca_Zeit):
Larnaca_Tag()
else:
Larnaca_Nacht()
if (Dubai[(kw-1)*2]<Dubai_Zeit) and (Dubai[(kw-1)*2+1]>Dubai_Zeit):
Dubai_Tag()
else:
Dubai_Nacht()
if (Singapur[(kw-1)*2]<Singapur_Zeit) and (Singapur[(kw-1)*2+1]>Singapur_Zeit):
Singapur_Tag()
else:
Singapur_Nacht()
if (Perth[(kw-1)*2]<Perth_Zeit) and (Perth[(kw-1)*2+1]>Perth_Zeit):
Perth_Tag()
else:
Perth_Nacht()
CLock3_gpio()
# Vierte Gruppe mit 4 Städten
if (Darwin[(kw-1)*2]<Darwin_Zeit) and (Darwin[(kw-1)*2+1]>Darwin_Zeit):
Darwin_Tag()
else:
Darwin_Nacht()
if (Sydney[(kw-1)*2]<Sydney_Zeit) and (Sydney[(kw-1)*2+1]>Sydney_Zeit):
Sydney_Tag()
else:
Sydney_Nacht()
if (Hobart[(kw-1)*2]<Hobart_Zeit) and (Hobart[(kw-1)*2+1]>Hobart_Zeit):
Hobart_Tag()
else:
Hobart_Nacht()
if (Auckland[(kw-1)*2]<Auckland_Zeit) and (Auckland[(kw-1)*2+1]>Auckland_Zeit):
Auckland_Tag()
else:
Auckland_Nacht()
CLock4_gpio()
crashed = False
enable_all_gpio()
while not crashed:
kw = datetime.date.today().isocalendar()[1]
x = datetime.datetime.now()
leds_an_aus()
if crashed:
disable_all_gpio()
quit()
Comments