Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from machine import Pin, PWM from time import sleep #este metodo def set_vel_motor_M1(vel): #configurar pines para motor M1 ain_1 = PWM(Pin(12)) ain_2 = PWM(Pin(13)) #Fijar las frecuencias a 60Hz ain_1.freq(80) ain_2.freq(80) #fijar la velocidad if(vel>0): ain_1.duty(vel*10) ain_2.duty(0) elif(vel<0):#permite verificar varias condiciones al incluir una o más verificaciones elif después de su declaración if inicial. vel = -vel ain_1.duty(0) ain_2.duty(vel*10) else: ain_1.duty(0) ain_2.duty(0) def main(): vel = 250 step = 10 while(1): set_vel_motor_M1(vel) vel += step sleep(2) if(vel>100 or vel<-100): step = -step vel += step print(vel) pass if __name__ == "__main__": main()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)