Closed Rotemoyal closed 4 years ago
Hi. Each time set_pin_mode_stepper is called a new stepper object is created in the sketch and the previous object is not deleted, so you may be running out of available memory and crashing the sketch. The sketch was designed to only run a single motor. You can try adding the following lines after line 897 and perhaps that might solve the problem:
if(stepper){
delete(stepper);
}
I am a little confused by your statements about i2c. Are you using an i2c motor driver? If you are, then you will need to use the i2c API to control the motors and not the stepper motor interface. The stepper motor API was tested using a ULN2003 driver board.
Just to let you know I am working on a new library called telemetrix that replaces Firmata. There are 2 versions of the client, telemeterix and an asycnio version, telemetrix-aio. The sketch for telemetrix is called Telemetrix4Arduino. It was designed to be a much simpler than Firmata and as a result, adding a new library is also much simpler. So, if you wanted to pick a stepper library that supports multiple motors, it should be fairly straight forward to add it toboth a telemetrix cleint and the Telemetrix4Arduino sketch. I am in the process of documenting the project which will include instructions on how to add a new library. Just to give you an idea of using telemetrix, when I added DHT support for FirmataExpress, it took about 2 weeks worth of effort to get it working. With telemtrix, I had it working within a day. If you would like to try using telemetrix and add a stepper library, I would be happy to guide you through it.
Please let me know if you try deleting the old objects if that works.
Thanks for your detailed answer. I added the if statement above, and it solved the problem!! That was really quick and accurate (:
Regarding the i2c - I really mixed two unrelated things - my bad. Thanks for sharing about Telemetrix - i will take a look if I need more features.
The bottom line - you really saved my project; Thanks!
Glad I was of help.
Hi. I am using multiple steppers on my board, so i need a way to control them from pymata-express. pymata-express is not supporting in "stepper_write" for a specific stepper, so I tried to run "set_pin_mode_stepper" before every "stepper write", with the appropriate stepper. That has worked, but it's buggy - every 9 or 10 writings, the arduino ignores the query. I have tried to get in the FirmataExpress code and change I2C_MAX_QUERIES value, or call to disableI2CPins() when queryIndex is reaching the max value, but it didn't help. Can you support this scenario in FirmataExpress, or give me an advice what i need to change in the code so it will work? Thanks a lot!