Most cases of premature ejaculation do not have a clear cause. With sexual experience and age, men often learn to delay orgasm. Premature ejaculation may occur with a new partner, only in certain sexual situations, or if it has been a long time since the last ejaculation. Psychological factors such as anxiety, guilt, or depression can cause premature ejaculation. In some cases, premature ejaculation may be related to a medical cause such as hormonal problems, injury, or a side effect of certain medicines. Quick flash to our customers: order cialis online uk no rx if you need generic cialis and get fast delivery to london. Worrying that you won't be able to perform in bed can make it harder for you to do just that. Anxiety from other parts of your life can also spill over into the bedroom. Full information about Kamagra product line by Adjanta - buy kamagra online in uk.

Arduino to Maya Mocap II

August 1st, 2009

Another proof of concept: Maya processing and recording three simultaneous data streams from the Arduino at ~30 fps. There’s still only the one button on the Arduino, but I’m faking three sensors by reading and transmitting its state three times.

The keys for the spheres’ “simultaneous” state changes are never more than about 50 milliseconds apart. In every mocap test I’ve run so far, every key has wound up quantized by multiples of 10 milliseconds in the timeline, perhaps due to the pySerial sampling rate or some internal Maya clock… suspicious.

Code follows:

The Arduino board setup is the same as before.

Arduino code

// Fake three-sensor output based on the Button script

 const int buttonPin = 2;     // the number of the pushbutton pin
 const int ledPin =  13;      // the number of the LED pin

 int buttonState1 = 0;         // three variables for reading the same pushbutton status
 int buttonState2 = 0;
 int buttonState3 = 0;
 void setup() {

   // initialize the LED pin as an output:
   pinMode(ledPin, OUTPUT);      
   // initialize the pushbutton pin as an input:
   pinMode(buttonPin, INPUT);
   Serial.begin(9600);        // connect to the serial port   

 void loop(){
   // read the state of the pushbutton value:
   buttonState1 = digitalRead(buttonPin);
   // check if the pushbutton is pressed.
   // if it is, the buttonState is HIGH:
   if (buttonState1 == HIGH) {     
     // turn LED on:    
     digitalWrite(ledPin, HIGH);
     Serial.println("1 1 1 1");
   else {
     // turn LED off:
     digitalWrite(ledPin, LOW); 
     Serial.println("1 0 0 0");

   buttonState2 = digitalRead(buttonPin);
   if (buttonState2 == HIGH) {     
     digitalWrite(ledPin, HIGH);
     Serial.println("2 1 1 1");
   else {
     digitalWrite(ledPin, LOW); 
     Serial.println("2 0 0 0");

   buttonState3 = digitalRead(buttonPin);
   if (buttonState3 == HIGH) {     
     digitalWrite(ledPin, HIGH);
     Serial.println("3 1 1 1");
   else {
     digitalWrite(ledPin, LOW); 
     Serial.println("3 0 0 0");

   delay(30); // 30 millisecond delay = 33 1/3 hz
// end

The Python’s a little buggy, but if it fails on launch with type mismatch errors just try again.

Maya Python code

### three-vector button record
sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32")
sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32\lib")
import time, sys, serial, win32file, win32con
import maya.cmds as cmds
import maya.mel as mel

mel.eval('setNamedPanelLayout( "Single Perspective View" )')


try: ser
except: 1
else: ser.close()

# open serial connection - adjust settings for your input device
ser = serial.Serial(

recordStart = timerX()
totalTime = timerX(startTime=recordStart)

sphere1 = sphere(n="sphere1")[0]
sphere2 = sphere(n="sphere2")[0]
sphere3 = sphere(n="sphere3")[0]
cmds.setAttr( 'sphere2.translateX', 5 )
cmds.setAttr( 'sphere3.translateX', -5 )


# progress bar, enabling "Esc"
gMainProgressBar = mel.eval('$tmp = $gMainProgressBar');
cmds.progressBar( gMainProgressBar,
        status='Reading serial data...' )

cmds.autoKeyframe( state=False )

while 1:
  data = ser.readline().split(' ')
  # convert list of strings to ints
  for i, v in enumerate(data): data[i] = int(v)
  whichObj = eval("sphere%s"%data[0])
  whichObj.scale.set((data[1]+1, data[2]+1, data[3]+1))
  keyTime = (timerX(startTime=recordStart))*24
  cmds.setKeyframe(str(whichObj), at="scaleX", v = data[1]+1, t = keyTime)
  cmds.setKeyframe(str(whichObj), at="scaleY", v = data[2]+1,t = keyTime)
  cmds.setKeyframe(str(whichObj), at="scaleZ", v = data[3]+1,t = keyTime)
  refresh() # update the viewscreen
  if cmds.progressBar(gMainProgressBar, query=True, isCancelled=True ) :
    # note the time to set playback range

endTime = timerX(startTime=recordStart)*24
cmds.progressBar(gMainProgressBar, edit=True, endProgress=True)

cmds.playbackOptions(l='once', max=endTime) # no looping
# turn on "Auto Frame" and show graph editor
mel.eval('animCurveEditor -edit -autoFit 1 graphEditor1GraphEd;')
mel.eval('setNamedPanelLayout( "Persp/Graph" )')
« previously: Fastidious Python Shrub | Home | next: Cartoon Forum trailer »

Leave a Reply