The Link uses create_read_block(). The function isn't blocking and returns -1. You have to read what create_read_block() returns and then wait until it's not -1. If you just want to use the information to use sync, you don't have to worry about what it returns, you just have to wait until it returns something other than -1.
KCotrone is correct. Use create_read_block(). It will return -1 while the create is busy with your script. Wait in a while loop for create_read_block() to return 1. At that point, the script has finished. This has to be changed from the stock opencode library. The new version should be on GitHub soon I believe (no release date though).
-Marty Rand
{
Senior programmer at Norman Advanced Robotics
Former senior programmer at Whittier Middle School
The library is going quite well. All of the move functions are much more accurate than the KIPR move functions. I know what the parameters or create_read_block() are but I don't understand what the parameters are asking for. I have been using
char buffer[1];
char *bptr = buffer;
for the buffer and 1 for the count (I got that code from the opencode). It worked but I would like to understand what it is doing
The Link uses create_read_block(). The function isn't blocking and returns -1. You have to read what create_read_block() returns and then wait until it's not -1. If you just want to use the information to use sync, you don't have to worry about what it returns, you just have to wait until it returns something other than -1.
edit: Also not that this is on 1.9.
KCotrone is correct. Use create_read_block(). It will return -1 while the create is busy with your script. Wait in a while loop for create_read_block() to return 1. At that point, the script has finished. This has to be changed from the stock opencode library. The new version should be on GitHub soon I believe (no release date though).
-Marty Rand
{
Senior programmer at Norman Advanced Robotics
Former senior programmer at Whittier Middle School
Youth Advisory Council
All around nerd
}
I just updated the create_sensor portion to include the changes to create_read_block.
If you'd like a place to get started with a function similar to sync the create movements you can look here:
https://github.com/normanadvanced/OpenCode/blob/master/opencode/create/c...
Ok, thank you. I have already looked at the sync function you have written and it has been quite helpful.
Ok, thank you. I have already looked at the sync function you have written and it has been quite helpful.
If you have any other questions regarding the create, I'd be happy to answer them. How is the create library going?
The library is going quite well. All of the move functions are much more accurate than the KIPR move functions. I know what the parameters or create_read_block() are but I don't understand what the parameters are asking for. I have been using
char buffer[1];
char *bptr = buffer;
for the buffer and 1 for the count (I got that code from the opencode). It worked but I would like to understand what it is doing