Incremental servo

Selfbondage software and other kinky developments

Moderators: Riddle, Shannon SteelSlave

User avatar
atiedslut
*
Posts: 22
Joined: 25 Jun 2010, 00:58
Location: Florida, USA
Contact:

Re: Incremental servo

Post by atiedslut »

6am...thats a punishment :-)

I only run the start.exe once to make sure the servo is at zero degrees before I start the session. After that I just use your motion detector program with Pain3.exe. So each time it detects me move it advances the servo a little more until it gets to the maxteaseposition value.

I found that my servo which is rather old will not reliably move with less than 5deg steps so I may need to get a new servo but otherwise it works ok.

I think my next project is to add a 2nd servo to respond to sounds and control it in the same manner .
Stephanie
User avatar
qwerty212
Moderator
Posts: 1064
Joined: 23 Mar 2010, 20:24

Re: Incremental servo

Post by qwerty212 »

Hi again. What I mean in my previous post is that your pain3.exe does:

Code: Select all

;movetostartposition()
Sleep (1000)
movetoteasingposition()
So before it increases the current position to the new teasing position it move to zero degrees. It is not necessary as the servo will remain in the previous teasing position until it recieves a new order.

I would love to see a post from you with pictures when you have all the 312 setup. There are some users that use to ask how can it be possible to be teased with a computer.

Glad that you have it working :)
User avatar
atiedslut
*
Posts: 22
Joined: 25 Jun 2010, 00:58
Location: Florida, USA
Contact:

Re: Incremental servo

Post by atiedslut »

Hi, ah, ok that was just me being lazy , I'd just commented out the function call.

This is my final code for servo A

Code: Select all

#include 'CommMG.au3'
#include <Misc.au3>


_Singleton("PAIN") ;this instruction will not let to be pain.exe running at the same time
;Internal for the Serial UDF
Global $sportSetError = ''
_CommSetDllPath(@ScriptDir & "\commg.dll") ; you just have to have the comm.dll in the same folder than pain.exe
;COM Vars
Global $CMPort = IniRead(@ScriptDir & "\Settings.ini", "Settings", "Port", "4") ; Port to be used in the serial comunication. Set it in the .ini file.
Global $CmBoBaud = 9600 ; Baud
Global $CmboDataBits = 8 ; Data Bits
Global $CmBoParity = "none" ; Parity
Global $CmBoStop = 1 ; Stop
Global $setflow = 2 ; Flow
_CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, $setflow)
_CommSetRTS(0)
_CommSetDTR(0)

Sleep (1000) ; a little sleep before the servo moves to the teasing position
movetoteasingposition() ; the instruction that will move the servo to the teasing position.

Func movetoteasingposition() ;the funtion that is going to tease you by moving a small amount each time.


Local $newteasingposition =  IniRead(@ScriptDir & "\Settings.ini", "Settings", "CurrentPosition", "0")  ; we read the current position, in case value doesn't exist it takes zero as default

$StepSize = IniRead(@ScriptDir & "\Settings.ini" , "Settings" , "StepSize", "5")  ; read step for the servo

$newteasingposition = $newteasingposition + $StepSize ;the new position will be the currentposition plus the step

If $newteasingposition >= IniRead(@ScriptDir & "\Settings.ini", "Settings", "MaxTeasingposition", "180") Then    ;If the current position is the ssme or greater than the max positioon allowed in the .ini file then exit

Exit

Endif

 IniWrite(@ScriptDir & "\Settings.ini", "Settings", "CurrentPosition",$newteasingposition) ; we store the new position in the .ini file for the next time we execute the program

   _CommSendString(StringFormat("A%03d", Int($newteasingposition))); we send this position to the Arduino board

   sleep (1000) ; we wait this amount of miliseconds until the servo reaches the position.


Exit ; as we do not want the servo to come back to zero.


EndFunc
What I plan on doing now is drive a second servo "B" in the same way as a second tease.

I'll take some photos and post them once I have something set up I'm happy to share.

Thank you for all your help. I'm enjoying learning Autoit , its been 30yrs since I did any coding (in Pascal !).
Stephanie
Post Reply