Arduino Digital Output

831 views
Skip to first unread message

Ben Dykstra

unread,
Jan 4, 2022, 4:28:12 PM1/4/22
to Bonsai Users

Hi all,

I am tracking the position of a mouse in a behavioral arena in bonsai. Whenever the mouse crosses a certain point, I want to turn on an LED light using arduino. My bonsai tree seems to work as intended but the digital output node does not trigger the LED. Do you have any ideas about this?

Best,

Ben

BlinkWithoutDelay_bonsai.ino
BonsaiArduinoTest.bonsai

brunocruz

unread,
Jan 5, 2022, 2:34:53 AM1/5/22
to Bonsai Users
Hi Ben,

In order to use the Arduino package, you need to upload the firmata protocol to your Arduino. In Arduino's IDE, go to File -> Examples -> Firmata -> StandardFirmata, and upload this last sketch.
Afterward, your bonsai workflow should work as intended.

Cheers,
Bruno

Ben Dykstra

unread,
Jan 5, 2022, 9:51:51 AM1/5/22
to Bonsai Users
Hi Bruno,

Is there anyway to insert some of my own custom code into Firmata? I am trying to move a conveyor belt and I need to tell the belt how far to move.

Best,
Ben

brunocruz

unread,
Jan 5, 2022, 2:31:34 PM1/5/22
to Bonsai Users
Hey,

You have several options. One is indeed to write custom code in Firmata. Tbh, I have not played with this solution that much. So maybe someone else can help you out hopefully. I am curious to know how well it works.

Alternatively, you can implement a simple serial communication protocol as I have suggested before. (https://groups.google.com/g/bonsai-users/c/0-eIYPe8rKo/m/11chWHvOBgAJ).

Out of curiosity, what communication protocol are you using to interface with your motor?

cheers,
B
Reply all
Reply to author
Forward
0 new messages