'''
Aufgabenstellung: Schieberegister
Code by Anna Pinchuk (3CHEL)
Lab Group 3

* Circuit build
* Pseudocode
* Attempt using bitshifting (a>>n)
* Pins etc.

Internal
35  A
33  B
14  C
13  D

Buttons
18  STCP
23  SCLR
34  DS

Output
22  QA
19  QB
16  QC
15  QD

pseudocode

flanke-> if(current_state != past_state)


if STCP:
  internal pins -> output pins

for each iLED:
  led(state)

-----with valcallback if I have time-----

if (SHCP_flanke):
  pins >> 1

if (STCP_flanke):
  for each QLED:
    led(state)

if (SCLR):
  for each QLED:
    led(0)
'''

from time import sleep
from machine import Pin
from Pins import *
#from shiftregister import shiftregister
#real code ㄷㄷㄷ

STCP = Buttons["STCP"]
SCLR = Buttons["SCLR"]
DS = Buttons["DS"]


def to_binary(num):
  return num

def to_decimal(pins):
  num = 0
  for position, item in enumerate(pins):
    num += item * 2**position # ** = pow(x,y)
  return num

def shift(num):
  to_decimal(num)
  return num >> 1

#def flanke():

def internal():
  


def clr():
  for item in LEDs[]:
    item = 0

def output():
  for item in LEDs[]:
    item = Internal[]


while (true):
  internal()

  if (SHCP):
    shift(pins)

  if (STCP):
    output()

  if (SCLR):
    for each in LEDs:
      clr()

'''
num = 0

a -> 2^0
b -> 2^1
c -> 2^2
d -> 2^3
...

for position, item in enumerate(num[]):
  num += item * pow(2, position)

'''
'''
14 = 1110

14 / 2 = 7 ()

'''