B4R Question PWM signal Arduino uno

Jaames

Active Member
Licensed User
Longtime User
B4X:
    Dim pwm As Pin
    'Initialize UNO D10 pin as output
    pwm.Initialize(10,pwm.MODE_OUTPUT)
   
    'use the pin to write 50% duty cycle of the 8 bit  pwm :
    pwm.AnalogWrite(127)
 
Upvote 0

Beja

Expert
Licensed User
Longtime User

Hi Jaams,

Will the above code generate continuous frequency on pin 10, or one cycle only?
I think time to buy an oscilloscope
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
It will generate continuous frequency.

Note that not all pins support PWM: https://www.arduino.cc/en/Reference/AnalogWrite

Thanks Erel, that's good news and always wanted to control Quadcopters (drones) using only b4a and NOT the RC controller, now can do this by manipulating the duty cycle for motor speeds, and replacing the drone electronics with Arduino and a driver circuit.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…