updated code on slave for wire