Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support for SingleWireSerial #6

Open
sebastiannielsen opened this issue Aug 23, 2024 · 4 comments
Open

Feature Request: Support for SingleWireSerial #6

sebastiannielsen opened this issue Aug 23, 2024 · 4 comments

Comments

@sebastiannielsen
Copy link

sebastiannielsen commented Aug 23, 2024

Feature Request:

Support for SingleWireSerial:
https://github.com/felias-fogg/SingleWireSerial

In this way, the servo can be directly connected to a Arduino without any components in-between.

Currently, if you try to:

#include <SCServo.h>
#include <SingleWireSerial.h>

 SCSCL sc;
 SingleWireSerial ServoSerial(false);

 void setup(){
         ServoSerial.begin(1000000);
         sc.pSerial = &ServoSerial;
         while(!ServoSerial) {}
 }

it will complain:

error: cannot convert 'SingleWireSerial*' to 'HardwareSerial*' in assignment
sc.pSerial = &ServoSerial;
^~~~~~~~~~~
exit status 1
Compilation error: cannot convert 'SingleWireSerial*' to 'HardwareSerial*' in assignment

(NOTE: The warning in SingleWireSerial about not being able to use servos, applies to regular PWM servos, since the Timer objects will be occupied by the SingleWireSerial library, and thus analog and PWM output is unavailable, so it should be fine using SingleWireSerial for serial servos)

@ksatirli
Copy link
Member

ksatirli commented Sep 4, 2024

Hey @sebastiannielsen 👋🏼

This looks like a solid suggestion. Is this something you feel comfortable writing code for?

@sebastiannielsen
Copy link
Author

sebastiannielsen commented Sep 4, 2024

I tried by replacing the HardwareSerial to SingleWireSerial in the code, and aswell removing the length parameter from the write() calls (as the write() in SingleWireSerial does not require a length parameter) but it didn't work.

Tried aswell setting the baudrate to 125kbaud (both in servo by sending 0x06 + 0x03, and in .begin() command) as SWS doesn't support too fast communication, but didn't work either.

So needs more delicate tools like serial analytic tools and oscilloscopes to properly write code for, which I don't have.

(after changing to SingleWireSerial + removing length parameter, the code do compile, but the serial servo doesn't respond)

@ksatirli
Copy link
Member

ksatirli commented Sep 4, 2024

That sounds involved! Can you share more about the setup you're using and what you're building?

We don't currently have access to those tools either, but more information can help you and us!

@sebastiannielsen
Copy link
Author

Im currently building a safe motor controller.
That gets the signal from the access control board, and the controls the bolt motor based on that.

I was not able to get SingleWireSerial working so I ended up buying a TTLinker board and then everything works.

But would be good if you wouldn't need the TTLinker board.

20240905_210851.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants