fortisq
Canada
Asked
Skills Sendserial Syntex Help.
Hello,
I have been using EZ-Script for sendserial commands because I'm not much of a programmer to make my own skills. But i would like to convert my ez-scripts to skills. i have finished the tutorial but am having some syntex problems with Visual Studio.
EZ-Script Syntex: SendSerial( d0, 57600, 0xf0, 0xaa, 0x05, 0x04, 0x55)
?
Related Hardware EZ-B IoTiny
Awesome - making a robot skill is fun and super fast. Specifically when you build it for what you want that others can use.
The great thing about Visual Studio is Code Complete (Intellisense). When you start typing, it will display parameters for you to select from. Here's an example when typing for SendSerial on the Primary EZB
So a completed example using the above syntax would be...
I see you're using the EZBManager's SendSerial, which will parse the text, but not as efficient as the example I gave above. Using the SendSerial helper that you discovered, the syntax would pass the port as a string. It isn't as efficient nor is it as expandable as using the above version. But for example it would look like...
I'd recommend the first example I displayed... because that way you can specify the port as an enum. Your config screen can use the ARC.UCForms.UC.UCPortButton user control on the config form. You can get the selected port with....
and set the port with....
I don't pretend to understand most of the coding for making a skill using Visual Studio Code but I'm trying to understand some of the basics. When I use a Uart port for sendserial commands using EZ-Script I first have to initialize the uart port. Does the corrected syntax that DJ provided do that? I think that is what he means when he says specify the port as an enum?
Just for reference to what I'm asking, My ez script to initialize the uart port on the EZB looks like this:
Then I send the command to the Sabertooth/Kangaroo:
DAve, send serial and uartwrite are different.
You do not initialize anything with sendserial
OK, I've got more to learn I guess. LOL. I seemed to be confusing sendserial with simple serial commands I send through the Uart port.
Yah, sendserial uses software to fake sending serial. It’s called bitbang. It can’t receive but it can send.
the uart commands use the built in hardware uart which needs to be initialized. This is because the hardware uart has a buffer to receive data.
the uart is far more reliable than the sendserial.
Thanks for the lesson. It's more clear now.
So the old version 3 ezb must have used bitbang to send serial? That version could send but not receive.
That’s right - the v3 did not have a uart for receiving serial data.
Thanks DJ. I never put the two together. I sometimes wondered why a digital pin could send but not receive serial data. It's great to learn new things.