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 with no prescription 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 oral jelly online in australia.

Basic Arduino to Maya II

July 27th, 2009

Here’s Maya reading real-time input from an Arduino board, set up in the circuit from the Arduino Button tutorial, and assuming the environment setup from my first Arduino post:

I’ve tweaked the code for the video to make the readout easier to see.

Code follows:

Arduino code

// Serial button, modified from Tom Igoe's Button script at
// http://www.arduino.cc/en/Tutorial/Button

 const int buttonPin = 2;     // the number of the pushbutton pin
 const int ledPin =  13;      // the number of the LED pin
 int buttonState = 0;         // variable for reading the pushbutton status

 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:
   buttonState = digitalRead(buttonPin);
   // check if the pushbutton is pressed.
   // if it is, the buttonState is HIGH:
   if (buttonState == HIGH) {     
     // turn LED on:    
     digitalWrite(ledPin, HIGH);  
     Serial.print("1");
   } 
   else {
     // turn LED off:
     digitalWrite(ledPin, LOW); 
     Serial.print("0");
   }
   delay(100); // update 10 times a second
 }
//

Maya Python code

## simple button read
import time
import sys
sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32")
import win32file
sys.path.append( "C:\Program Files\Common Files\Python\Python25\Lib\site-packages\win32\lib")
import win32con
import serial

ser = serial.Serial(
  port='COM3',
  baudrate=9600,
  parity=serial.PARITY_NONE,
  stopbits=serial.STOPBITS_ONE,
  bytesize=serial.EIGHTBITS
)

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

while totalTime < 5: # 5-second timer prevents infinite loop
  print ser.read()
  totalTime = timerX(startTime=startTime)

ser.close()
##
« previously: Basic Arduino to Maya Communication | Home | next: Basic Arduino to Maya III »