How to use SerialStringRead

666 views
Skip to first unread message

Jack Eastman

unread,
Sep 6, 2021, 2:36:08 PM9/6/21
to Bonsai Users
Hello, I am trying to use Bonsai to read a string received from an Arduino, but am currently unable to get it to work. I know the serial port is connected and can read from the same port over the arduino serial monitor. However, I cannot get an input in bonsai from the serial port. Currently, I just have the serialstringread node connected to a textwriter to record input from the serial port. I've tried multiple different baud rates on the arduino, but still haven't been able to get a connection. Is there a specific serial configuration I need to use to communicate with bonsai? Should I use firmata instead?

brunocruz

unread,
Sep 7, 2021, 3:50:27 AM9/7/21
to Bonsai Users
Hello!

The attached code works for me, can you give it a try?

Arduino is running the following code:
"""""""
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Hello");
  delay(1000);
}
""""""""

Cheers,
Bruno
serialString.bonsai
Message has been deleted

Gonçalo Lopes

unread,
Dec 29, 2021, 8:12:21 PM12/29/21
to Amalia Papanikolaou, Bonsai Users
Hi Amalia and Jack,

Yes, the Leonardo does require a special setting when opening a serial port.
You have to set the DtrEnable property to True, then it should work.

The Arduino module in Bonsai enforces this by default, but not the raw CreateSerialPort.

Hope this helps.

On Sat, 16 Oct 2021 at 11:08, Amalia Papanikolaou <ameli...@gmail.com> wrote:
Hi, 

I've got the same issue.
The code posted by Bruno doesn't work.
The Arduino is a Leonardo (I've got an UNO and it works for that one).
Any suggestions?

Thanks,
Amalia
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/9368b618-2952-48b0-9e29-18d3945763c0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages