<reponame>binokaryg/Piano-LED-Visualizer<filename>workspace/keys.py<gh_stars>0
"""if (((i - 5) % 14 == 0) || ((i != 0)) && ((i + 1) % 14 == 0))   
//places to be skipped (there is no B# and E#)
 {
     offset++;   //remember how many skips have been made
     continue;
 } """

def notes_to_led(note):
    original_note = note
    note = int(note)
    if(note > 92):
        note_offset = 2
    elif(note > 55):
        note_offset = 1
    else:
        note_offset = 0
    led = (note - 35)*2 - note_offset
    return led

def test_note():
    assert notes_to_led(36) == 2, "Expected {0}, Got {1}".format(2, notes_to_led(36))
    assert notes_to_led(37) == 4, "Expected {0}, Got {1}".format(4, notes_to_led(37))

test_note()
print("Everything passed")
"""if (((i - 5) % 14 == 0) || ((i != 0)) && ((i + 1) % 14 == 0))   
//places to be skipped (there is no B# and E#)
 {
     offset++;   //remember how many skips have been made
     continue;
 } """

def notes_to_led(note):
    original_note = note
    note = int(note)
    if(note > 92):
        note_offset = 2
    elif(note > 55):
        note_offset = 1
    else:
        note_offset = 0
    led = (note - 35)*2 - note_offset
    return led

def test_note():
    assert notes_to_led(36) == 2, "Expected {0}, Got {1}".format(2, notes_to_led(36))
    assert notes_to_led(37) == 4, "Expected {0}, Got {1}".format(4, notes_to_led(37))

test_note()
print("Everything passed")
if (((i - 5) % 14 == 0) || ((i != 0)) && ((i + 1) % 14 == 0))    //places to be skipped (there is no B# and E#)  {      offset++;   //remember how many skips have been made      continue;  }