Schema, RTC
This commit is contained in:
parent
5b8935059d
commit
a51ee17f7c
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
|
|
@ -8,8 +8,15 @@
|
|||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:nanoatmega328]
|
||||
platform = atmelavr
|
||||
board = nanoatmega328
|
||||
[env:d1_mini]
|
||||
platform = espressif8266
|
||||
board = d1_mini
|
||||
framework = arduino
|
||||
lib_deps = wayoda/LedControl@^1.0.6
|
||||
monitor_speed = 115200
|
||||
lib_deps =
|
||||
wayoda/LedControl@^1.0.6
|
||||
adafruit/RTClib@^1.13.0
|
||||
tzapu/WiFiManager@^0.16.0
|
||||
adafruit/Adafruit SSD1306@^2.4.6
|
||||
adafruit/Adafruit GFX Library@^1.10.10
|
||||
adafruit/Adafruit BusIO@^1.8.2
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -83,4 +83,100 @@ X GND 9 0 -1000 100 U 50 50 1 1 P N
|
|||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# MCU_Module_WeMos_D1_mini
|
||||
#
|
||||
DEF MCU_Module_WeMos_D1_mini U 0 20 Y Y 1 F N
|
||||
F0 "U" 150 750 50 H V L CNN
|
||||
F1 "MCU_Module_WeMos_D1_mini" 50 -750 50 H V L CNN
|
||||
F2 "Module:WEMOS_D1_mini_light" 0 -1150 50 H I C CNN
|
||||
F3 "" -1850 -1150 50 H I C CNN
|
||||
$FPLIST
|
||||
WEMOS*D1*mini*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -300 700 300 -700 1 1 10 f
|
||||
X ~RST 1 -400 400 100 R 50 50 1 1 I
|
||||
X GND 10 0 -800 100 U 50 50 1 1 W
|
||||
X D4 11 400 0 100 L 50 50 1 1 B
|
||||
X D3 12 400 100 100 L 50 50 1 1 B
|
||||
X SDA/D2 13 400 200 100 L 50 50 1 1 B
|
||||
X SCL/D1 14 400 300 100 L 50 50 1 1 B
|
||||
X RX 15 -400 100 100 R 50 50 1 1 I
|
||||
X TX 16 -400 0 100 R 50 50 1 1 O
|
||||
X A0 2 400 500 100 L 50 50 1 1 I
|
||||
X D0 3 400 400 100 L 50 50 1 1 B
|
||||
X SCK/D5 4 400 -100 100 L 50 50 1 1 B
|
||||
X MISO/D6 5 400 -200 100 L 50 50 1 1 B
|
||||
X MOSI/D7 6 400 -300 100 L 50 50 1 1 B
|
||||
X CS/D8 7 400 -400 100 L 50 50 1 1 B
|
||||
X 3V3 8 100 800 100 D 50 50 1 1 w
|
||||
X 5V 9 -100 800 100 D 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# Timer_RTC_DS1307+
|
||||
#
|
||||
DEF Timer_RTC_DS1307+ U 0 20 Y Y 1 F N
|
||||
F0 "U" -350 350 50 H V C CNN
|
||||
F1 "Timer_RTC_DS1307+" 50 350 50 H V L CNN
|
||||
F2 "Package_DIP:DIP-8_W7.62mm" 0 -500 50 H I C CNN
|
||||
F3 "" 0 -200 50 H I C CNN
|
||||
ALIAS DS1307N+
|
||||
$FPLIST
|
||||
DIP*W7.62mm*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S -400 300 400 -300 0 1 10 f
|
||||
X X1 1 -500 -100 100 R 50 50 1 1 I
|
||||
X X2 2 -500 -200 100 R 50 50 1 1 I
|
||||
X VBAT 3 0 400 100 D 50 50 1 1 W
|
||||
X GND 4 0 -400 100 U 50 50 1 1 W
|
||||
X SDA 5 -500 100 100 R 50 50 1 1 B
|
||||
X SCL 6 -500 200 100 R 50 50 1 1 I
|
||||
X SQW/OUT 7 500 0 100 L 50 50 1 1 C
|
||||
X VCC 8 -100 400 100 D 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_+5V
|
||||
#
|
||||
DEF power_+5V #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -150 50 H I C CNN
|
||||
F1 "power_+5V" 0 140 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 2 0 1 0 -30 50 0 100 N
|
||||
P 2 0 1 0 0 0 0 100 N
|
||||
P 2 0 1 0 0 100 30 50 N
|
||||
X +5V 1 0 0 0 U 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_GND
|
||||
#
|
||||
DEF power_GND #PWR 0 0 Y Y 1 F P
|
||||
F0 "#PWR" 0 -250 50 H I C CNN
|
||||
F1 "power_GND" 0 -150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
|
||||
X GND 1 0 0 0 D 50 50 1 1 W N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# power_PWR_FLAG
|
||||
#
|
||||
DEF power_PWR_FLAG #FLG 0 0 N N 1 F P
|
||||
F0 "#FLG" 0 75 50 H I C CNN
|
||||
F1 "power_PWR_FLAG" 0 150 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
|
||||
X pwr 1 0 0 0 U 50 50 0 0 w
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
.title KiCad schematic
|
||||
U1 /A1 /A1 /D0 /A1 NC_01 /DP1 /DP1 NC_02 /DP1 /A1 5161AS
|
||||
U3 /E1 /E1 /D0 /E1 NC_03 /D1 /D1 NC_04 /D1 /D1 5161AS
|
||||
U2 /C1 /C1 /D0 /C1 NC_05 /B1 /B1 NC_06 /B1 /C1 5161AS
|
||||
U4 /G1 /G1 /D0 /G1 NC_07 /F1 /F1 NC_08 /F1 /F1 5161AS
|
||||
U0 NC_09 /D0 /D4 Net-_U0-Pad4_ /D6 /D2 /D3 /D7 Net-_U0-Pad4_ /D5 /D1 NC_10 NC_11 /A1 /F1 /B1 /G1 NC_12 NC_13 /C1 /E1 /DP1 /D1 NC_14 MAX7219
|
||||
U5 /A1 /A1 /D1 /A1 NC_15 /DP1 /DP1 NC_16 /DP1 /A1 5161AS
|
||||
U7 /E1 /E1 /D1 /E1 NC_17 /D1 /D1 NC_18 /D1 /D1 5161AS
|
||||
U6 /C1 /C1 /D1 /C1 NC_19 /B1 /B1 NC_20 /B1 /C1 5161AS
|
||||
U8 /G1 /G1 /D1 /G1 NC_21 /F1 /F1 NC_22 /F1 /F1 5161AS
|
||||
U9 /A1 /A1 /D2 /A1 NC_23 /DP1 /DP1 NC_24 /DP1 /A1 5161AS
|
||||
U11 /E1 /E1 /D2 /E1 NC_25 /D1 /D1 NC_26 /D1 /D1 5161AS
|
||||
U10 /C1 /C1 /D2 /C1 NC_27 /B1 /B1 NC_28 /B1 /C1 5161AS
|
||||
U12 /G1 /G1 /D2 /G1 NC_29 /F1 /F1 NC_30 /F1 /F1 5161AS
|
||||
U13 /A1 /A1 /D3 /A1 NC_31 /DP1 /DP1 NC_32 /DP1 /A1 5161AS
|
||||
U15 /E1 /E1 /D3 /E1 NC_33 /D1 /D1 NC_34 /D1 /D1 5161AS
|
||||
U14 /C1 /C1 /D3 /C1 NC_35 /B1 /B1 NC_36 /B1 /C1 5161AS
|
||||
U16 /G1 /G1 /D3 /G1 NC_37 /F1 /F1 NC_38 /F1 /F1 5161AS
|
||||
U17 /A1 /A1 /D4 /A1 NC_39 /DP1 /DP1 NC_40 /DP1 /A1 5161AS
|
||||
U19 /E1 /E1 /D4 /E1 NC_41 /D1 /D1 NC_42 /D1 /D1 5161AS
|
||||
U18 /C1 /C1 /D4 /C1 NC_43 /B1 /B1 NC_44 /B1 /C1 5161AS
|
||||
U20 /G1 /G1 /D4 /G1 NC_45 /F1 /F1 NC_46 /F1 /F1 5161AS
|
||||
U21 /A1 /A1 /D5 /A1 NC_47 /DP1 /DP1 NC_48 /DP1 /A1 5161AS
|
||||
U23 /E1 /E1 /D5 /E1 NC_49 /D1 /D1 NC_50 /D1 /D1 5161AS
|
||||
U22 /C1 /C1 /D5 /C1 NC_51 /B1 /B1 NC_52 /B1 /C1 5161AS
|
||||
U24 /G1 /G1 /D5 /G1 NC_53 /F1 /F1 NC_54 /F1 /F1 5161AS
|
||||
U25 /A1 /A1 /D6 /A1 NC_55 /DP1 /DP1 NC_56 /DP1 /A1 5161AS
|
||||
U27 /E1 /E1 /D6 /E1 NC_57 /D1 /D1 NC_58 /D1 /D1 5161AS
|
||||
U26 /C1 /C1 /D6 /C1 NC_59 /B1 /B1 NC_60 /B1 /C1 5161AS
|
||||
U28 /G1 /G1 /D6 /G1 NC_61 /F1 /F1 NC_62 /F1 /F1 5161AS
|
||||
U29 /A1 /A1 /D7 /A1 NC_63 /DP1 /DP1 NC_64 /DP1 /A1 5161AS
|
||||
U31 /E1 /E1 /D7 /E1 NC_65 /D1 /D1 NC_66 /D1 /D1 5161AS
|
||||
U30 /C1 /C1 /D7 /C1 NC_67 /B1 /B1 NC_68 /B1 /C1 5161AS
|
||||
U32 /G1 /G1 /D7 /G1 NC_69 /F1 /F1 NC_70 /F1 /F1 5161AS
|
||||
.end
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +1,185 @@
|
|||
(kicad_pcb (version 4) (host kicad "dummy file") )
|
||||
(kicad_pcb (version 20171130) (host pcbnew 5.1.9+dfsg1-1)
|
||||
|
||||
(general
|
||||
(thickness 1.6)
|
||||
(drawings 0)
|
||||
(tracks 0)
|
||||
(zones 0)
|
||||
(modules 1)
|
||||
(nets 11)
|
||||
)
|
||||
|
||||
(page A4)
|
||||
(layers
|
||||
(0 F.Cu signal)
|
||||
(31 B.Cu signal)
|
||||
(32 B.Adhes user)
|
||||
(33 F.Adhes user)
|
||||
(34 B.Paste user)
|
||||
(35 F.Paste user)
|
||||
(36 B.SilkS user)
|
||||
(37 F.SilkS user)
|
||||
(38 B.Mask user)
|
||||
(39 F.Mask user)
|
||||
(40 Dwgs.User user)
|
||||
(41 Cmts.User user)
|
||||
(42 Eco1.User user)
|
||||
(43 Eco2.User user)
|
||||
(44 Edge.Cuts user)
|
||||
(45 Margin user)
|
||||
(46 B.CrtYd user)
|
||||
(47 F.CrtYd user)
|
||||
(48 B.Fab user)
|
||||
(49 F.Fab user)
|
||||
)
|
||||
|
||||
(setup
|
||||
(last_trace_width 0.25)
|
||||
(trace_clearance 0.2)
|
||||
(zone_clearance 0.508)
|
||||
(zone_45_only no)
|
||||
(trace_min 0.2)
|
||||
(via_size 0.8)
|
||||
(via_drill 0.4)
|
||||
(via_min_size 0.4)
|
||||
(via_min_drill 0.3)
|
||||
(uvia_size 0.3)
|
||||
(uvia_drill 0.1)
|
||||
(uvias_allowed no)
|
||||
(uvia_min_size 0.2)
|
||||
(uvia_min_drill 0.1)
|
||||
(edge_width 0.05)
|
||||
(segment_width 0.2)
|
||||
(pcb_text_width 0.3)
|
||||
(pcb_text_size 1.5 1.5)
|
||||
(mod_edge_width 0.12)
|
||||
(mod_text_size 1 1)
|
||||
(mod_text_width 0.15)
|
||||
(pad_size 1.524 1.524)
|
||||
(pad_drill 0.762)
|
||||
(pad_to_mask_clearance 0)
|
||||
(aux_axis_origin 0 0)
|
||||
(visible_elements FFFFFF7F)
|
||||
(pcbplotparams
|
||||
(layerselection 0x010fc_ffffffff)
|
||||
(usegerberextensions false)
|
||||
(usegerberattributes true)
|
||||
(usegerberadvancedattributes true)
|
||||
(creategerberjobfile true)
|
||||
(excludeedgelayer true)
|
||||
(linewidth 0.100000)
|
||||
(plotframeref false)
|
||||
(viasonmask false)
|
||||
(mode 1)
|
||||
(useauxorigin false)
|
||||
(hpglpennumber 1)
|
||||
(hpglpenspeed 20)
|
||||
(hpglpendiameter 15.000000)
|
||||
(psnegative false)
|
||||
(psa4output false)
|
||||
(plotreference true)
|
||||
(plotvalue true)
|
||||
(plotinvisibletext false)
|
||||
(padsonsilk false)
|
||||
(subtractmaskfromsilk false)
|
||||
(outputformat 1)
|
||||
(mirror false)
|
||||
(drillshape 1)
|
||||
(scaleselection 1)
|
||||
(outputdirectory ""))
|
||||
)
|
||||
|
||||
(net 0 "")
|
||||
(net 1 "Net-(U1-Pad1)")
|
||||
(net 2 "Net-(U1-Pad2)")
|
||||
(net 3 "Net-(U1-Pad3)")
|
||||
(net 4 "Net-(U1-Pad4)")
|
||||
(net 5 "Net-(U1-Pad5)")
|
||||
(net 6 "Net-(U1-Pad6)")
|
||||
(net 7 "Net-(U1-Pad7)")
|
||||
(net 8 "Net-(U1-Pad8)")
|
||||
(net 9 "Net-(U1-Pad9)")
|
||||
(net 10 "Net-(U1-Pad10)")
|
||||
|
||||
(net_class Default "This is the default net class."
|
||||
(clearance 0.2)
|
||||
(trace_width 0.25)
|
||||
(via_dia 0.8)
|
||||
(via_drill 0.4)
|
||||
(uvia_dia 0.3)
|
||||
(uvia_drill 0.1)
|
||||
(add_net "Net-(U1-Pad1)")
|
||||
(add_net "Net-(U1-Pad10)")
|
||||
(add_net "Net-(U1-Pad2)")
|
||||
(add_net "Net-(U1-Pad3)")
|
||||
(add_net "Net-(U1-Pad4)")
|
||||
(add_net "Net-(U1-Pad5)")
|
||||
(add_net "Net-(U1-Pad6)")
|
||||
(add_net "Net-(U1-Pad7)")
|
||||
(add_net "Net-(U1-Pad8)")
|
||||
(add_net "Net-(U1-Pad9)")
|
||||
)
|
||||
|
||||
(module 7seg:7SegmentLED_LTS6760_LTS6780 (layer F.Cu) (tedit 5FFF72B2) (tstamp 60B99E85)
|
||||
(at 130.175 66.675)
|
||||
(descr "7-Segment Display, LTS67x0, http://optoelectronics.liteon.com/upload/download/DS30-2001-355/S6760jd.pdf")
|
||||
(tags "7Segment LED LTS6760 LTS6780")
|
||||
(path /60B94B6C)
|
||||
(fp_text reference U1 (at 7.62 -2.42) (layer F.SilkS)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value 5161AS (at 7.62 12.58) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_text user %R (at 7.87 5.08) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_line (start 1.905 -1.33) (end 13.335 -1.33) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 1.905 11.49) (end 13.335 11.49) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -2.015 -0.22) (end -2.015 11.38) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 17.255 11.38) (end 17.255 -1.22) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -2.16 -1.47) (end -2.16 11.63) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 17.4 -1.47) (end 17.4 11.63) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -2.16 -1.47) (end 17.4 -1.47) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -2.16 11.63) (end 17.4 11.63) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -0.905 -1.22) (end -1.905 -0.22) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 17.145 11.38) (end 17.145 -1.22) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -1.905 -0.22) (end -1.905 11.38) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -1.905 11.38) (end 17.145 11.38) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 12.62 2.08) (end 7.62 1.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 7.62 1.08) (end 2.62 0.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 2.62 0.08) (end 2.62 7.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 2.62 7.08) (end 7.62 8.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 12.62 9.08) (end 7.62 8.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 7.62 8.08) (end 7.62 1.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 12.62 2.08) (end 12.62 9.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_circle (center 2.62 9.08) (end 3.067214 9.08) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -0.905 -1.22) (end 17.145 -1.22) (layer F.Fab) (width 0.1))
|
||||
(pad 1 thru_hole rect (at 0 0 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 1 "Net-(U1-Pad1)"))
|
||||
(pad 2 thru_hole oval (at 0 2.54 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 2 "Net-(U1-Pad2)"))
|
||||
(pad 3 thru_hole oval (at 0 5.08 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 3 "Net-(U1-Pad3)"))
|
||||
(pad 4 thru_hole oval (at 0 7.62 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 4 "Net-(U1-Pad4)"))
|
||||
(pad 5 thru_hole oval (at 0 10.16 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 5 "Net-(U1-Pad5)"))
|
||||
(pad 6 thru_hole oval (at 15.24 10.16 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 6 "Net-(U1-Pad6)"))
|
||||
(pad 7 thru_hole oval (at 15.24 7.62 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 7 "Net-(U1-Pad7)"))
|
||||
(pad 8 thru_hole oval (at 15.24 5.08 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 8 "Net-(U1-Pad8)"))
|
||||
(pad 9 thru_hole oval (at 15.24 2.54 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 9 "Net-(U1-Pad9)"))
|
||||
(pad 10 thru_hole oval (at 15.24 0 270) (size 1.524 2.524) (drill 0.8) (layers *.Cu *.Mask)
|
||||
(net 10 "Net-(U1-Pad10)"))
|
||||
(model ${KISYS3DMOD}/Display_7Segment.3dshapes/7SegmentLED_LTS6760_LTS6780.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
update=22/05/2015 07:44:53
|
||||
update=Sa 12 Jun 2021 19:57:05 CEST
|
||||
version=1
|
||||
last_client=kicad
|
||||
[general]
|
||||
|
|
@ -31,3 +31,13 @@ NetIExt=net
|
|||
version=1
|
||||
LibDir=
|
||||
[eeschema/libraries]
|
||||
[schematic_editor]
|
||||
version=1
|
||||
PageLayoutDescrFile=
|
||||
PlotDirectoryName=
|
||||
SubpartIdSeparator=0
|
||||
SubpartFirstId=65
|
||||
NetFmtName=Pcbnew
|
||||
SpiceAjustPassiveValues=0
|
||||
LabSize=50
|
||||
ERC_TestSimilarLabels=1
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
232
src/main.cpp
232
src/main.cpp
|
|
@ -1,5 +1,15 @@
|
|||
#include <Arduino.h>
|
||||
#include "LedControl.h"
|
||||
#include "RTClib.h" // RTC library
|
||||
|
||||
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
|
||||
#include <ESP8266WebServer.h>
|
||||
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
/*
|
||||
|
||||
|
|
@ -16,15 +26,68 @@ We have only a single MAX72XX.
|
|||
|
||||
*/
|
||||
|
||||
LedControl lc = LedControl(12, 10, 11, 1);
|
||||
|
||||
int iteration = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
// initialize RTC library
|
||||
RTC_DS1307 rtc;
|
||||
DateTime now;
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||
|
||||
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
||||
#define OLED_RESET D8-1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
|
||||
|
||||
// Max7219 PINs:
|
||||
#define MAX_CLK D5
|
||||
#define MAX_CS D3
|
||||
#define MAX_DIN D7
|
||||
|
||||
LedControl lc = LedControl(MAX_DIN, MAX_CLK, MAX_CS, 1);
|
||||
|
||||
/* we always wait a bit between updates of the display */
|
||||
|
||||
unsigned long delaytime = 500;
|
||||
|
||||
void configModeCallback(WiFiManager *myWiFiManager);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
//WiFiManager
|
||||
//Local intialization. Once its business is done, there is no need to keep it around
|
||||
WiFiManager wifiManager;
|
||||
//reset settings - for testing
|
||||
//wifiManager.resetSettings();
|
||||
|
||||
//set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
|
||||
wifiManager.setAPCallback(configModeCallback);
|
||||
|
||||
|
||||
|
||||
//fetches ssid and pass and tries to connect
|
||||
//if it does not connect it starts an access point with the specified name
|
||||
//here "AutoConnectAP"
|
||||
//and goes into a blocking loop awaiting configuration
|
||||
if (!wifiManager.autoConnect())
|
||||
{
|
||||
Serial.println("failed to connect and hit timeout");
|
||||
//reset and try again, or maybe put it to deep sleep
|
||||
ESP.reset();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if you get here you have connected to the WiFi
|
||||
Serial.println("connected...yeey :)");
|
||||
|
||||
|
||||
/* The MAX72XX is in power-saving mode on startup, we have to do a wakeup call */
|
||||
|
||||
|
|
@ -39,9 +102,45 @@ void setup()
|
|||
/* and clear the display */
|
||||
|
||||
|
||||
|
||||
|
||||
Serial.println("starting");
|
||||
|
||||
delay(3000); // wait for console opening
|
||||
|
||||
//rtc.begin();
|
||||
|
||||
if (! rtc.begin()) {
|
||||
Serial.println("Couldn't find RTC");
|
||||
//while (1);
|
||||
return;
|
||||
}
|
||||
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
|
||||
|
||||
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Show initial display buffer contents on the screen --
|
||||
// the library initializes this with an Adafruit splash screen.
|
||||
display.display();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void configModeCallback(WiFiManager *myWiFiManager)
|
||||
{
|
||||
Serial.println("Entered config mode");
|
||||
Serial.println(WiFi.softAPIP());
|
||||
//if you used auto generated SSID, print it
|
||||
Serial.println(myWiFiManager->getConfigPortalSSID());
|
||||
}
|
||||
|
||||
|
||||
void printNumber(int v) {
|
||||
int ones;
|
||||
int tens;
|
||||
|
|
@ -73,65 +172,82 @@ void printNumber(int v) {
|
|||
lc.setDigit(0,0,(byte)ones,false);
|
||||
}
|
||||
|
||||
void hello()
|
||||
{
|
||||
|
||||
delay(500);
|
||||
lc.setDigit(0,0,0, false);
|
||||
lc.setDigit(0,0,1, false);
|
||||
lc.setDigit(0,0,2, false);
|
||||
lc.setDigit(0,0,3, false);
|
||||
//lc.setLed(0,0,0,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
/*
|
||||
lc.setLed(0,0,2,true);
|
||||
lc.setLed(0,0,3,true);
|
||||
lc.setLed(0,0,4,true);
|
||||
lc.setLed(0,0,6,true);
|
||||
lc.setLed(0,0,0,true);
|
||||
*/
|
||||
//delay(2000);
|
||||
/*
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,1,true);
|
||||
lc.setLed(0,0,2,true);
|
||||
lc.setLed(0,0,4,true);
|
||||
lc.setLed(0,0,5,true);
|
||||
lc.setLed(0,0,7,true);
|
||||
lc.setLed(0,0,0,true);
|
||||
*/
|
||||
|
||||
//delay(2000);
|
||||
//lc.setLed(0,0,4,true);
|
||||
//lc.setLed(0,0,6,true);
|
||||
//lc.setLed(0,0,iteration%8,true);
|
||||
|
||||
lc.setLed(0,0,1,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,3,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,5,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,7,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,0,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,6,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,4,true);
|
||||
delay(80);
|
||||
lc.clearDisplay(0);
|
||||
lc.setLed(0,0,2,true);
|
||||
iteration++;
|
||||
delay(50);
|
||||
lc.clearDisplay(0);
|
||||
DateTime now = rtc.now();
|
||||
|
||||
Serial.print(now.year(), DEC);
|
||||
Serial.print('/');
|
||||
Serial.print(now.month(), DEC);
|
||||
Serial.print('/');
|
||||
Serial.print(now.day(), DEC);
|
||||
Serial.print(" (");
|
||||
Serial.print(") ");
|
||||
Serial.print(now.hour(), DEC);
|
||||
Serial.print(':');
|
||||
Serial.print(now.minute(), DEC);
|
||||
Serial.print(':');
|
||||
Serial.print(now.second(), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.print(" since midnight 1/1/1970 = ");
|
||||
Serial.print(now.unixtime());
|
||||
Serial.print("s = ");
|
||||
Serial.print(now.unixtime() / 86400L);
|
||||
Serial.println("d");
|
||||
|
||||
// calculate a date which is 7 days and 30 seconds into the future
|
||||
DateTime future (now + TimeSpan(7,12,30,6));
|
||||
|
||||
Serial.print(" now + 7d + 30s: ");
|
||||
Serial.print(future.year(), DEC);
|
||||
Serial.print('/');
|
||||
Serial.print(future.month(), DEC);
|
||||
Serial.print('/');
|
||||
Serial.print(future.day(), DEC);
|
||||
Serial.print(' ');
|
||||
Serial.print(future.hour(), DEC);
|
||||
Serial.print(':');
|
||||
Serial.print(future.minute(), DEC);
|
||||
Serial.print(':');
|
||||
Serial.print(future.second(), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.println();
|
||||
|
||||
|
||||
display.clearDisplay();
|
||||
|
||||
display.setTextSize(1); // Normal 1:1 pixel scale
|
||||
display.setTextColor(WHITE); // Draw white text
|
||||
display.setCursor(0, 0); // Start at top-left corner
|
||||
display.cp437(true); // Use full 256 char 'Code Page 437' font
|
||||
|
||||
|
||||
char buffer[20];
|
||||
|
||||
sprintf(buffer, "%02d:%02d:%02d %02d/%02d/%02d", now.hour(), now.minute(), now.second(), now.day(), now.month(), now.year());
|
||||
|
||||
display.write(buffer);
|
||||
|
||||
display.display();
|
||||
|
||||
|
||||
lc.setDigit(0,3,now.hour()/10,false);
|
||||
lc.setDigit(0,2,now.hour()%10,false);
|
||||
lc.setDigit(0,1,now.minute()/10,false);
|
||||
lc.setDigit(0,0,now.minute()%10,false);
|
||||
|
||||
/*
|
||||
lc.setDigit(0,0,3,false);
|
||||
lc.setDigit(0,1,2,false);
|
||||
lc.setDigit(0,2,1,false);
|
||||
lc.setDigit(0,3,0,false);
|
||||
*/
|
||||
delay(1000);
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue