Main Site Documentation

Porting Arduino code to FEZ: PWM



i have i question.

In my Arduino Code i wrote analogWrite(PINXYZ, 1500); . I use this for controlling Servos, 1500 is the middle position.

How must be the code in C#?
Must i use Set() or SetPulse()?

Best regards

Edit: I just saw the new Forum category for porting questions. sorry


Have you seen the example code we have for servo? It is listed along with our servo on product page.


Ok, i just read it.
A Servo becomes the same signals as a ESC, thats why i wrote Servo.
Theoritical i can use the Servo-class for controlling an ESC.
0 => No Arm
90 => Mid Speed
180 => Full Speed

But i´m calculating my values from 1000-2000.

Maybe you can give me the Servo-class code?



The code is there! Did you look?
Please look again at servo brochure and at code driver example

Also, the book explain how PWM works so between all these you can do anything you like with PWM and you shouldn’t need any extra help.


By the way, the book is updated and now it explains servos. See PWM section in updated book dated May 5th. It also explains PWM.SetPulse()



with the book update that is a lot of clearlier to me. I will use the books solution because its easyer to use for me.
This code works also:
This is a modified Servo Class Version.

Thanks in advance