Main Site Documentation

Porting Arduino code to FEZ: PWM


#1

Hello,

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
Max

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


#2

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


#3

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?

Regards


#4

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.


#5

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()


#6

Hello,

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:
http://m-holdercodings.pytalhost.com/Sonstiges/ESC.html
This is a modified Servo Class Version.

Thanks in advance

regards