Send trigger by serial port from excel column

hello everyone, I have a question. if any can help me out with it….

I’m sending 2 sound stimuli (oddball column in the image) at 1000 and 400 hz. At this point, I’m sending a trigger through a serial port to my acquisition device. As I show in image 2 sent a ‘1’ and ‘0’ (line 2 and 7 of code). Can I make to read that value from my spreadsheet? because so far It sends 1s and 0z regardless of the type of stimuli. For this, I need to use columns E and F ( t_odd_ini; t_odd_stop) i.e if I send the 400 stimuli in row 4 also need to send 12 instead of 1 and 13 instead of 0.

tank you in advance.


I already solved it. I replace the instruction with port.write, str.encode(chr(t_odd_ini))
it sends exactly the same number that I have in my spreadsheet (0-9) but with 10,11.12…. doesn’t work. So, so far I fix it. maybe is a bug?
Thank you for your answer.