Author Topic: bad interaction between varable servo widgets and fixed servo widgets  (Read 584 times)

scnstlr

  • Newbie
  • *
  • Posts: 2
I've been working on a servo pan / tilt control webpage and i was planning to add several preset values for servo positions and use those widgets on the page and set values via iobridge.

However i found the following that ultimately forced me to use a varaible widget and pass the values from within the web page. I have verified that this is not a coding issue but seems to be an issue on iobridges side. I think.

i have 2 controls: one to increment a servo and one to go to preset value.

i use the variable widget along with the widgetGetString command to increment the pan either left or right , up or down etc.

for example:

Position = (parseInt(widgetGetString('xxxxxxxxxxxx')) - 10);
widgetSetString('xxxxxxxxxxxx',Position);

this works fine

then i have  serval widgets to go to a fix positions for example:
widgetExecute('xxxxxxxxxxxx');


now here is the issue:

if i go to a preset position it works fine so lets say i go to 2 preset positions one after another.

when i then go to the varaible widget it actually starts at the position of the seconod to the last preset position. not the position from the last preset clicked.
if i click the incremental widget again it then works fine. however going back and forth between the widgets the position gets messed up and ultimately not usable.

so it seems to me that the widgetGetString is not either updating correctly or not reading the last position.

Hopefully you can recreate the issue.

i'd be happy to give the widgets that i'm using but not ready to show my webpage.

I also noticed that the WidgetGetString only works with variable widgets might be nice to be abel to use the for fixed positions also.

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
You may have discovered the issue by now. Sorry for the delay, this post slipped through the cracks.

The issue is that the fixed widgets do not update the variable widgets.

A solution would be to use only the variable widgets. Since you are using JavaScript, you can just use JavaScript to update the position.

On load up of a variable widget, you will know the current servo position. Set that as a global var (Position) in JS and use the widgetSetString('xxxxxxxxxxxx',Position); to control the servo. If you always modify the var Position, then you always know the current position.

Let us know if this helps.
ioBridge Support
Community Team

scnstlr

  • Newbie
  • *
  • Posts: 2
that's what i eventually did with java and used the varibale widgets thorughout. it's unfortumate that the fixed widgets don't report their position to variable widgets. it woudl simplify some of the programming.

anyways i appreciate the feedback.

i was able to removetly control pan/tilt zoom and start/stop of a video camera as well as video sending to an iphone for video taping weddings.

it worked well!