diff --git a/motors/boot.py b/motors/boot.py deleted file mode 100644 index e69de29..0000000 diff --git a/motors/README.md b/motors/i2c/README.md similarity index 100% rename from motors/README.md rename to motors/i2c/README.md diff --git a/motors/main.py b/motors/i2c/main.py similarity index 100% rename from motors/main.py rename to motors/i2c/main.py diff --git a/motors/motor.py b/motors/i2c/motor.py similarity index 100% rename from motors/motor.py rename to motors/i2c/motor.py diff --git a/motors/pca9685.py b/motors/i2c/pca9685.py similarity index 100% rename from motors/pca9685.py rename to motors/i2c/pca9685.py diff --git a/motors/servo.py b/motors/i2c/servo.py similarity index 100% rename from motors/servo.py rename to motors/i2c/servo.py diff --git a/motors/stepper.py b/motors/i2c/stepper.py similarity index 100% rename from motors/stepper.py rename to motors/i2c/stepper.py diff --git a/motors/pwm/README.md b/motors/pwm/README.md new file mode 100644 index 0000000..f06a246 --- /dev/null +++ b/motors/pwm/README.md @@ -0,0 +1,5 @@ +# PWM + +## Resources + +- [PWM L298N Article](https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-bridge/) \ No newline at end of file diff --git a/motors/pwm/main.py b/motors/pwm/main.py new file mode 100644 index 0000000..5887909 --- /dev/null +++ b/motors/pwm/main.py @@ -0,0 +1,24 @@ +from machine import Pin, PWM +from time import sleep +print("Clank controller coming online") + +# pwm0 = PWM(Pin(0)) # create PWM object from a pin +# pwm0.freq() # get current frequency +# pwm0.freq(1000) # set frequency +# pwm0.duty() # get current duty cycle +# pwm0.duty(200) # set duty cycle +# pwm0.deinit() # turn off PWM on the pin + + +pwm12 = PWM(Pin(12), freq=1000, duty=0) +pwm13 = PWM(Pin(13), freq=1000, duty=0) + +while True: + pwm12.duty(512) + sleep(2) + pwm12.duty(0) + sleep(.3) + pwm13.duty(512) + sleep(2) + pwm13.duty(0) + sleep(.3) diff --git a/scripts/profile b/scripts/profile index fa50bcc..cde2745 100644 --- a/scripts/profile +++ b/scripts/profile @@ -5,12 +5,19 @@ ARG=$1 if [ "$ARG" = '--kit' ] || [ "$ARG" = '-k' ]; then echo "Using ESP-WOVER-kit_v4.1" - export AMPY_PORT=/dev/cu.usbserial-143101 +# export AMPY_PORT=/dev/cu.usbserial-143101 + export AMPY_PORT=/dev/cu.usbserial-14401 fi +function _set_kit_usbserial (){ + +} + function repl_connect (){ echo "Connecting to $AMPY_PORT" + echo "Use Ctrl+a then k to kill the session" + sleep 2; screen $AMPY_PORT $BAUD_RATE } diff --git a/tmp/.gitignore b/tmp/.gitignore new file mode 100644 index 0000000..8e5bbf0 --- /dev/null +++ b/tmp/.gitignore @@ -0,0 +1 @@ +*.py \ No newline at end of file diff --git a/tmp/README.md b/tmp/README.md new file mode 100644 index 0000000..c085af0 --- /dev/null +++ b/tmp/README.md @@ -0,0 +1,20 @@ +# Temporary workspace + +Content in this directory should never be uploaded to git. + +## Usage + +Use this space to pull down files and rapidly iterate on them + +Pull files: +``` +source scripts/profile +upy ls +upy get tmp/ +``` + +Upload files back +``` +upy put tmp/ + +``` \ No newline at end of file