# LCD RS mcu.pin. to digital mcu.pin. 12
# LCD Enable mcu.pin. to digital mcu.pin. 11

# wires.add(Wire.up(sim, 13, lcd, 14)); // PD7 = D7 (lcd)
# wires.add(Wire.up(sim, 12, lcd, 13)); // PD6 = D6 (lcd)
# wires.add(Wire.up(sim, 11, lcd, 12)); // PD5 = D5 (lcd)
# wires.add(Wire.up(sim, 6, lcd, 11)); // PD4 = D4 (lcd)
# wires.add(Wire.up(sim, 5, lcd, 10)); // PD3 = D3 (lcd)
# wires.add(Wire.up(sim, 4, lcd, 9)); // PD2 = D2 (lcd)
# wires.add(Wire.up(sim, 3, lcd, 8)); // PD1 = D1 (lcd)
# wires.add(Wire.up(sim, 2, lcd, 7)); // PD0 = D0 (lcd)

# LCD R/W mcu.pin. to ground
# 10K resistor:
# ends to +5V and ground
# wiper to LCD VO mcu.pin. (mcu.pin. 3)

mcu.type=atmega328p
mcu.pin.2.dir=output
mcu.pin.2.label=D0 - LCD D0
mcu.pin.3.dir=output
mcu.pin.3.label=D1 - LCD D1
mcu.pin.4.dir=output
mcu.pin.4.label=D2 - LCD D2
mcu.pin.5.dir=output
mcu.pin.5.label=D3 - LCD D3
mcu.pin.6.dir=output
mcu.pin.6.label=D4 - LCD D4
mcu.pin.11.dir=output
mcu.pin.11.label=D5 - LCD D5
mcu.pin.12.dir=output
mcu.pin.12.label=D6 - LCD D6
mcu.pin.13.dir=output
mcu.pin.13.label=D7 - LCD D7
mcu.pin.14.dir=input
mcu.pin.14.label=D8 - Switch
mcu.pin.15.dir=output
mcu.pin.15.label=D9 - Red LED
mcu.pin.16.dir=output
mcu.pin.16.label=D10 - Blue LED
mcu.pin.17.dir=output
mcu.pin.17.label=D11 - LCD Enable
mcu.pin.18.dir=output
mcu.pin.18.label=D12 - LCD RS
mcu.pin.19.dir=output
mcu.pin.19.label=D13 - Green LED
mcu.pin.23.dir=output
mcu.pin.23.label=A0 - SHCP (shift register clock input)
mcu.pin.24.dir=output
mcu.pin.24.label=A1 - STCP (storage register clock input)
mcu.pin.25.dir=output
mcu.pin.25.label=A2 - DS (Serial data input)
mcu.pin.26.dir=input
mcu.pin.26.label=A3
mcu.pin.27.dir=input
mcu.pin.27.label=A4
mcu.pin.28.dir=input
mcu.pin.28.label=A5

widgets=switch:PushSwitch, lcd:LCD, blueLED:LED, redLED:LED, greenLED:LED, shiftOut:ShiftRegister, yellowLED:LED

switch.label=Switch - Active low
switch.pin.1.connect=mcu.pin.14
switch.activeLow=true

redLED.label=Red LED - Active low
redLED.colour=Red
redLED.pin.1.connect=mcu.pin.15
redLED.activeLow=true

blueLED.label=Blue LED
blueLED.colour=Blue
blueLED.pin.1.connect=mcu.pin.16
blueLED.activeLow=false

greenLED.label=Green LED - Active low
greenLED.colour=Green
greenLED.pin.1.connect=mcu.pin.19
greenLED.activeLow=true

lcd.label=16x2 LCD
lcd.pin.4.connect=mcu.pin.18
lcd.pin.6.connect=mcu.pin.17
# PD7 = D7 (lcd)
lcd.pin.14.connect=mcu.pin.13
# PD6 = D6 (lcd)
lcd.pin.13.connect=mcu.pin.12
# PD5 = D5 (lcd)
lcd.pin.12.connect=mcu.pin.11
# PD4 = D4 (lcd)
lcd.pin.11.connect=mcu.pin.6
# PD3 = D3 (lcd)
lcd.pin.10.connect=mcu.pin.5
# PD2 = D2 (lcd)
lcd.pin.9.connect=mcu.pin.4
# PD1 = D1 (lcd)
lcd.pin.8.connect=mcu.pin.3
# PD0 = D0 (lcd)
lcd.pin.7.connect=mcu.pin.2

shiftOut.label=74HC595 Shift Register
shiftOut.ledsEnabled=true
shiftOut.pin.7.label=Q7
shiftOut.pin.6.label=Q6
shiftOut.pin.5.label=Q5
shiftOut.pin.4.label=Q4
shiftOut.pin.3.label=Q3
shiftOut.pin.2.label=Q2
shiftOut.pin.1.label=Q1
shiftOut.pin.15.label=Q0
shiftOut.pin.10.connect=GND
shiftOut.pin.11.connect=mcu.pin.23
shiftOut.pin.12.connect=mcu.pin.24
shiftOut.pin.14.connect=mcu.pin.25

# This one is connected to Q3 on the Shift Register chip
yellowLED.label=ShiftOut Q3 - Active low
yellowLED.colour=Yellow
yellowLED.pin.1.connect=shiftOut.pin.3
yellowLED.activeLow=true
