Manual for Vibrator-Control?

Ideas and instructions how you can make your own bondage toys.
tkv
*
Posts: 32
Joined: 25 Jul 2009, 14:42
Location: Finland

Re: Manual for Vibrator-Control?

Post by tkv »

Re: Arduino no longer showing up in devices, it could be the FTDI driver acting up. They've been known to "brick" devices that have clone chips in them. If the 'duino is a very cheap knockoff, it might be affected. Google ftdigate for more info
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

tkv wrote:Re: Arduino no longer showing up in devices, it could be the FTDI driver acting up. They've been known to "brick" devices that have clone chips in them. If the 'duino is a very cheap knockoff, it might be affected. Google ftdigate for more info
Just to save a lot of people from having to do the looking up:

"ftdigate" was the insertion of some extra code by FTDI in their (windows) drivers. This clever code would ruin devices with counterfeit chips.

They appear to have stopped doing it, probably because it caused both a shitstorm and because it degraded the trust in FTDI products in general.

https://hackaday.com/2014/10/22/watch-t ... ake-chips/
https://hackaday.com/tag/ftdigate/
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Arduino controls the vibe

Post by amity »

Hi there,
If you are interested what I am doing right now:
My modified "fade program"

/*
Fade

This example shows how to fade an LED on pin 9
using the analogWrite() function.

This example code is in the public domain.
*/

int led = 9; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
delay(40000);
}

// the loop routine runs over and over again forever:
void loop() {

// set the brightness of pin 9:
analogWrite(led, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(200);
if (brightness == 0)

// Delay "random 10 to 20 sec"
delay(random(10000, 20000));
}


I have accomplished a random delay between the cycles.
Can anybody tell me how to randomize the "brightness" = "power of the vibe"
(Until now it is from 0 to 255 in every loop = Boring)

Many thanks
amity
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

You just use random again (twice):

First draw a random number for the lower limit (0,250), then draw a random number for the upper limit (lowerlimit, 250) and use those two values instead of 0 and 255 in the fade loop.

Int lowlimit = random(0, 200);
Int upperlimit = random(lowlimit, 255);

Make it draw the new numbers when brightness equals 0 .
Or make a counter that makes it draw new numbers after running your desired number of cycles.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

Hi There,

I have found a wonderful program for flying "solo" with my arduino + vibro egg + me :-)

https://www.xeromag.com/sextech-tormentor.html
I hope it is ok to post the link like this...

The program itself is divided into several smaller programs which are supposed to tease you (me :D ).
The best thing about it is: the differnt programs are unprdictable. You will never know what comes next.

I have tested it and love.

However, the very first program ("case1") never came.
Cooincidence?

I would like to add a 10 minute delay function at the very beginning (to allow me to finish my preparations), but when I try the result is
a) a 10 minute delay between ervery small "case"=> not what I wanted.
b) the program will not run at all (mistake -upps)

Where is the right place to add the "delay"?
If someone would like to look into it: very much appreciated :)

Play safe
amity
User avatar
Dark_Lizerd
*****
Posts: 2416
Joined: 22 Oct 2006, 11:30
Location: New Mexico

Re: Manual for Vibrator-Control?

Post by Dark_Lizerd »

void setup() {
randomSeed(analogRead(0));
pinMode(ledpin, OUTPUT);
pinMode (sexPin, OUTPUT);
Serial.begin(9600);
}
--------- I would think adding the delay here would delay the start, but not for each loop
void loop() {
**** a delay here would delay each loop...
analogWrite (sexPin, 0); //Turn off toy

...
Where did you put your delay?
All advice is checked, re-checked and verified to be questionable...
Don't ask, we both wont understand the answer...
http://www.mediafire.com/download/09dtr ... e_V2_2.exe Not just for nubies any more...
Sergio
***
Posts: 255
Joined: 26 Mar 2016, 17:07
Location: UK, London

Re: Manual for Vibrator-Control?

Post by Sergio »

The initial 10 minute delay should come at the end of setup() (before the closing curly bracket) so it's executed once before the program moves on to the main loop, ie:

void setup() {
randomSeed(analogRead(0));
pinMode(ledpin, OUTPUT);
pinMode (sexPin, OUTPUT);
Serial.begin(9600);
delay(10000);
}

Also, the reason case 1 never happens is that there's no delay in it, so it is happening but for less than a millisecond. I suspect it's missing delay(randNum) after the digitalWrite, ie:

case 1:
// Run at random intensity for 10-45 seconds
randNum = random(1000,4500) * 10;
randIntensity = random (100,255)+1;
analogWrite (sexPin,randIntensity);
digitalWrite(ledpin, LOW);
delay(randNum);
break;
Sergio
***
Posts: 255
Joined: 26 Mar 2016, 17:07
Location: UK, London

Re: Manual for Vibrator-Control?

Post by Sergio »

Eek, no, my mistake. That will give a delay of ten seconds, not minutes. For a ten minute delay that line at the end of setup() should read "delay(600000);" (ten minutes times sixty seconds per minute times 1000 milliseconds in a second). Note that long delays are okay on classic Arduinos with nothing happening in the background, such as this case, but on devices like the ESP8266 which is ideal for a purpose like this, long delays will cause the watchdog timer to fire and you'll end up in an endless reset loop, so break up the delay into short delays in a loop, or save the time and spin checking the time until it's ten minutes later. If you have problems start with a delay of 1000 (one second) and increase it until it fails.

Alternatively use a spare pin with a switch contact on a wire that you can reach to start the operation immediately, or after a much shorter delay, or even a random delay.

Rather than bore people with more code here PM me if you get into difficulty - with the program - if your release doesn't work I can't help you. :lol:
User avatar
Gregovic
****
Posts: 1118
Joined: 26 Mar 2016, 21:31
Location: Netherlands

Re: Manual for Vibrator-Control?

Post by Gregovic »

I strongly suggest not using the delay command for anything over 500 milliseconds or for anything where you don't want the microcontroller to be completely frozen. Better to use the millis() function and check the elapsed time each time you run through the loop(). Check the "Blink without delay" tutorial for a primer on how to do this, shouldn't be too hard to figure out.

delay is really only intended for use on short delays when waiting for an input to settle or initializing a serial link or something. It is generally best to avoid using it for anything time related. Keep in mind if you have really long delays that millis() WILL overflow back to 0 after aprox. 50 days (IF you declared it as the default unsigned long. Some libraries or code changes could set this to a smaller format, leading to a faster overflow). In my experience using a this "check the needed time has elapsed" method is quite intuitive once you get used to it, and if you start working with multiple events that are co-dependent it makes it much easier to keep track of things.
How may I serve you? *Curtsey*
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

Thank you all for your input.

As I am still a learner and my abilities are limited :oops: , I will try the original "delay-function".
I am using a standard arduino uno board.
So I guess the "delay function" is safe (is it?).
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

It works perfectly well.

The main problem is, that it blocks the Arduino from doing most other things while it is running.

If you only want it to work as a simple timer, then you can use it.


But using the "millis" (=time since the start of the program) in stead of "delay" really is not hard at all.
https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

I`m glad that if have got the program up and running :-) - so I stick with the "delay"-function.

Can you tell me where I can influence the delay between two “cases”?
It varies between 20 and 40 sec, but I can`t figure out why or when.
random would be great, or is it already?

Thanks says amity
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

...got it!
Post Reply