James Martel
Published © GPL3+

What Do I Build Next? A Pico-ATMegaZero BOT part 2 of 2

I was looking for another BOT to build and then two new SBC's were announced or was it three SBC's?

IntermediateFull instructions provided4 hours218
What Do I Build Next? A Pico-ATMegaZero BOT part 2 of 2

Things used in this project

Hardware components

Mecanum chassis
×1
L298N Motor Co
×2
L9110S Motor Controller
×2
5 VDC Buck Convertor
×1
5 VDC Buck Convertor2
×1
16 channel I2C PWM controller
×1
18650 Battery holder with ON/OFF
×2
18650 batteries
×4
18650 multi battery charge/analyzer
×1
speed encoders 1
Not used in this initial build
×4
speed encode
Not used in this initial build
×4
Dupont Jumpers-Male to Male
×1
Dupont Jumpers-Female to Female
×1
Dupont Jumpers-Female to Male
×1
Miscellanous brass/nylon standoffs
×1
ATMegaZero32
×1

Software apps and online services

Arduino IDE
Arduino IDE
Thonny IDE for Windows
MicroPython
MicroPython
Circuitpython

Hand tools and fabrication machines

adjustable wrench
Plier, Needle Nose
Plier, Needle Nose
small philips screwdriver

Story

Read more

Schematics

ATMegaZero code wiring

interconnect

ATMegazero-32 wiring

ATMegazero-32 Arduino

ATMegazero-32 pin-out

L298N interconnect

Code

ATMegazero-32 code.py

MicroPython
Using Thonny IDE and micropython to program with Windows 10 laptop with dual L298N's and 4 Mecanum wheels
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# This example uses an L9110 H-bridge driver to run a DC Motor using two PWM pins.
#  https://www.adafruit.com/product/4489

# Hardware setup:
#   DC motor via L9110 H-bridge driver on two PWM pins that are on their own channels
#   e.g., RP2040 Pico pins GP28, GP27

import time
import board
import pwmio
from adafruit_motor import motor

PWM_PIN_A = board.D4  # pick any pwm pins on their own channels
PWM_PIN_B = board.D5
PWM_PIN_C = board.D8  # pick any pwm pins on their own channels
PWM_PIN_D = board.D7
PWM_PIN_E = board.D6  # pick any pwm pins on their own channels
PWM_PIN_F = board.D9
PWM_PIN_G = board.D10  # pick any pwm pins on their own channels
PWM_PIN_H = board.D13

# DC motor setup
# DC Motors generate electrical noise when running that can reset the microcontroller in extreme
# cases. A capacitor can be used to help prevent this.
pwm_a = pwmio.PWMOut(PWM_PIN_A, frequency=50)
pwm_b = pwmio.PWMOut(PWM_PIN_B, frequency=50)
motor1 = motor.DCMotor(pwm_a, pwm_b)
pwm_c = pwmio.PWMOut(PWM_PIN_C, frequency=50)
pwm_d = pwmio.PWMOut(PWM_PIN_D, frequency=50)
motor2 = motor.DCMotor(pwm_c, pwm_d)
pwm_e = pwmio.PWMOut(PWM_PIN_E, frequency=50)
pwm_f = pwmio.PWMOut(PWM_PIN_F, frequency=50)
motor3 = motor.DCMotor(pwm_e, pwm_f)
pwm_g = pwmio.PWMOut(PWM_PIN_G, frequency=50)
pwm_h = pwmio.PWMOut(PWM_PIN_H, frequency=50)
motor4 = motor.DCMotor(pwm_g, pwm_h)

print("***DC motor test***")

print("\nForwards slow")
motor1.throttle = 0.5
motor2.throttle = 0.5
motor3.throttle = 0.5
motor4.throttle = 0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nForwards")
motor1.throttle = 1.0
motor2.throttle = 1.0
motor3.throttle = 1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards")
motor1.throttle = -1.0
motor2.throttle = -1.0
motor3.throttle = -1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards slow")
motor1.throttle = -0.5
motor2.throttle = -0.5
motor3.throttle = -0.5
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn left")
motor1.throttle = -0.5
motor2.throttle = 1.0
motor3.throttle = -0.5
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn Right")
motor1.throttle = 1.0
motor2.throttle = -0.5
motor3.throttle = 1.0
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot left")
motor1.throttle = -1.0
motor2.throttle = 1.0
motor3.throttle = -1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot Right")
motor1.throttle = 1.0
motor2.throttle = -1.0
motor3.throttle = 1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nSpin freely")
motor1.throttle = None
motor2.throttle = None
motor3.throttle = None
motor4.throttle = None
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)

print("\n***Motor test is complete***")

ATMegaZero-32 Arduino code

Arduino
Arduino IDE code programming for dual L298N's and 4 Mecanum wheels
const int AIA = 8;
const int AIB = 4;
const int BIA = 6;
const int BIB = 7;
const int AIA2 = 12;
const int AIB2 = 13;
const int BIA2 = 9;
const int BIB2 = A5;

byte speed = 255;

void setup() {
 pinMode(AIA, OUTPUT);
 pinMode(AIB, OUTPUT);
 pinMode(BIA, OUTPUT);
 pinMode(BIB, OUTPUT);
 pinMode(AIA2, OUTPUT);
 pinMode(AIB2, OUTPUT);
 pinMode(BIA2, OUTPUT);
 pinMode(BIB2, OUTPUT);
}
void loop() {
 forward();
 delay(2000);
 backward();
 delay(2000);
 left();
 delay(2000);
 right();
 delay(2000);
 stop();
 delay(5000);
}
void backward()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, speed);
 analogWrite(BIA, 0);
 analogWrite(BIB, speed);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, speed);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, speed);
}
void forward()
{
 analogWrite(AIA, speed);
 analogWrite(AIB, 0);
 analogWrite(BIA, speed);
 analogWrite(BIB, 0);
 analogWrite(AIA2, speed);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, speed);
 analogWrite(BIB2, 0);
}
void left()
{
 analogWrite(AIA, speed);
 analogWrite(AIB, 0);
 analogWrite(BIA, 0);
 analogWrite(BIB, speed);
 analogWrite(AIA2, speed);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, speed);
}
void right()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, speed);
 analogWrite(BIA, speed);
 analogWrite(BIB, 0);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, speed);
 analogWrite(BIA2, speed);
 analogWrite(BIB2, 0);
}
void stop()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, 0);
 analogWrite(BIA, 0);
 analogWrite(BIB, 0);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, 0);
}

ATMegaZero Arduino code

Arduino
This code and wiring change is required if WIFI/ESP8266-ESP01S is to be used
const int AIA = 7;
const int AIB = 6;
const int BIA = 10;
const int BIB = A1;
const int AIA2 = 12;
const int AIB2 = A5;
const int BIA2 = A4;
const int BIB2 = A3;

byte speed = 255;

void setup() {
 pinMode(AIA, OUTPUT);
 pinMode(AIB, OUTPUT);
 pinMode(BIA, OUTPUT);
 pinMode(BIB, OUTPUT);
 pinMode(AIA2, OUTPUT);
 pinMode(AIB2, OUTPUT);
 pinMode(BIA2, OUTPUT);
 pinMode(BIB2, OUTPUT);
}
void loop() {
 stop();
 delay(5000);
 forward();
 delay(2000);
 backward();
 delay(2000);
 left();
 delay(2000);
 right();
 delay(2000);
 stop();
 delay(5000);
}
void backward()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, speed);
 analogWrite(BIA, 0);
 analogWrite(BIB, speed);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, speed);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, speed);
}
void forward()
{
 analogWrite(AIA, speed);
 analogWrite(AIB, 0);
 analogWrite(BIA, speed);
 analogWrite(BIB, 0);
 analogWrite(AIA2, speed);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, speed);
 analogWrite(BIB2, 0);
}
void left()
{
 analogWrite(AIA, speed);
 analogWrite(AIB, 0);
 analogWrite(BIA, 0);
 analogWrite(BIB, speed);
 analogWrite(AIA2, speed);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, speed);
}
void right()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, speed);
 analogWrite(BIA, speed);
 analogWrite(BIB, 0);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, speed);
 analogWrite(BIA2, speed);
 analogWrite(BIB2, 0);
}
void stop()
{
 analogWrite(AIA, 0);
 analogWrite(AIB, 0);
 analogWrite(BIA, 0);
 analogWrite(BIB, 0);
 analogWrite(AIA2, 0);
 analogWrite(AIB2, 0);
 analogWrite(BIA2, 0);
 analogWrite(BIB2, 0);
}

ATMegazero-32 code.py

MicroPython
This code and wiring revision is required to use the ESP8266-ESP01S WIFI module- copy and rename this code "code.py" and install
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# This example uses an L9110 H-bridge driver to run a DC Motor using two PWM pins.
#  https://www.adafruit.com/product/4489

# Hardware setup:
#   DC motor via L9110 H-bridge driver on two PWM pins that are on their own channels
#   e.g., RP2040 Pico pins GP28, GP27

import time
import board
import pwmio
from adafruit_motor import motor

PWM_PIN_A = board.D7  # PIN 16 (D4) pick any pwm pins on their own channels
PWM_PIN_B = board.D6  # PIN 18 (D5)
PWM_PIN_C = board.D10 # PIN 26 (D8) pick any pwm pins on their own channels
PWM_PIN_D = board.A1  # PIN 37
PWM_PIN_E = board.D12 # PIN 31 pick any pwm pins on their own channels
PWM_PIN_F = board.A5  # PIN 32 (D9)
PWM_PIN_G = board.A4  # PIN 33 pick any pwm pins on their own channels
PWM_PIN_H = board.A3  # PIN 35

# DC motor setup
# DC Motors generate electrical noise when running that can reset the microcontroller in extreme
# cases. A capacitor can be used to help prevent this.
pwm_a = pwmio.PWMOut(PWM_PIN_A, frequency=50)
pwm_b = pwmio.PWMOut(PWM_PIN_B, frequency=50)
motor1 = motor.DCMotor(pwm_a, pwm_b)
pwm_c = pwmio.PWMOut(PWM_PIN_C, frequency=50)
pwm_d = pwmio.PWMOut(PWM_PIN_D, frequency=50)
motor2 = motor.DCMotor(pwm_c, pwm_d)
pwm_e = pwmio.PWMOut(PWM_PIN_E, frequency=50)
pwm_f = pwmio.PWMOut(PWM_PIN_F, frequency=50)
motor3 = motor.DCMotor(pwm_e, pwm_f)
pwm_g = pwmio.PWMOut(PWM_PIN_G, frequency=50)
pwm_h = pwmio.PWMOut(PWM_PIN_H, frequency=50)
motor4 = motor.DCMotor(pwm_g, pwm_h)

print("***DC motor test***")

print("\nForwards slow")
motor1.throttle = 0.5
motor2.throttle = 0.5
motor3.throttle = 0.5
motor4.throttle = 0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nForwards")
motor1.throttle = 1.0
motor2.throttle = 1.0
motor3.throttle = 1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards")
motor1.throttle = -1.0
motor2.throttle = -1.0
motor3.throttle = -1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards slow")
motor1.throttle = -0.5
motor2.throttle = -0.5
motor3.throttle = -0.5
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn left")
motor1.throttle = -0.5
motor2.throttle = 1.0
motor3.throttle = -0.5
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn Right")
motor1.throttle = 1.0
motor2.throttle = -0.5
motor3.throttle = 1.0
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot left")
motor1.throttle = -1.0
motor2.throttle = 1.0
motor3.throttle = -1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot Right")
motor1.throttle = 1.0
motor2.throttle = -1.0
motor3.throttle = 1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nSpin freely")
motor1.throttle = None
motor2.throttle = None
motor3.throttle = None
motor4.throttle = None
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)

print("\n***Motor test is complete***")

Raspberry Pi PICO RP2040 micropython code

MicroPython
Mecanum 4 wheeled dual L298N's with PICO
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# This example uses an L9110 H-bridge driver to run a DC Motor using two PWM pins.
#  https://www.adafruit.com/product/4489

# Hardware setup:
#   DC motor via L9110 H-bridge driver on two PWM pins that are on their own channels
#   e.g., RP2040 Pico pins GP28, GP27

import time
import board
import pwmio
from adafruit_motor import motor

PWM_PIN_A = board.GP28  # pick any pwm pins on their own channels
PWM_PIN_B = board.GP27
PWM_PIN_C = board.GP26  # pick any pwm pins on their own channels
PWM_PIN_D = board.GP22
PWM_PIN_E = board.GP21  # pick any pwm pins on their own channels
PWM_PIN_F = board.GP20
PWM_PIN_G = board.GP19  # pick any pwm pins on their own channels
PWM_PIN_H = board.GP18


# DC motor setup
# DC Motors generate electrical noise when running that can reset the microcontroller in extreme
# cases. A capacitor can be used to help prevent this.
pwm_a = pwmio.PWMOut(PWM_PIN_A, frequency=50)
pwm_b = pwmio.PWMOut(PWM_PIN_B, frequency=50)
motor1 = motor.DCMotor(pwm_a, pwm_b)
pwm_c = pwmio.PWMOut(PWM_PIN_C, frequency=50)
pwm_d = pwmio.PWMOut(PWM_PIN_D, frequency=50)
motor2 = motor.DCMotor(pwm_c, pwm_d)
pwm_e = pwmio.PWMOut(PWM_PIN_E, frequency=50)
pwm_f = pwmio.PWMOut(PWM_PIN_F, frequency=50)
motor3 = motor.DCMotor(pwm_e, pwm_f)
pwm_g = pwmio.PWMOut(PWM_PIN_G, frequency=50)
pwm_h = pwmio.PWMOut(PWM_PIN_H, frequency=50)
motor4 = motor.DCMotor(pwm_g, pwm_h)

print("***DC motor test***")

print("\nForwards slow")
motor1.throttle = 0.5
motor2.throttle = 0.5
motor3.throttle = 0.5
motor4.throttle = 0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nForwards")
motor1.throttle = 1.0
motor2.throttle = 1.0
motor3.throttle = 1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards")
motor1.throttle = -1.0
motor2.throttle = -1.0
motor3.throttle = -1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nBackwards slow")
motor1.throttle = -0.5
motor2.throttle = -0.5
motor3.throttle = -0.5
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn left")
motor1.throttle = -0.5
motor2.throttle = 1.0
motor3.throttle = -0.5
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nTurn Right")
motor1.throttle = 1.0
motor2.throttle = -0.5
motor3.throttle = 1.0
motor4.throttle = -0.5
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot left")
motor1.throttle = -1.0
motor2.throttle = 1.0
motor3.throttle = -1.0
motor4.throttle = 1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nPivot Right")
motor1.throttle = 1.0
motor2.throttle = -1.0
motor3.throttle = 1.0
motor4.throttle = -1.0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nStop")
motor1.throttle = 0
motor2.throttle = 0
motor3.throttle = 0
motor4.throttle = 0
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)
time.sleep(1)

print("\nSpin freely")
motor1.throttle = None
motor2.throttle = None
motor3.throttle = None
motor4.throttle = None
print("  throttle:", motor1.throttle)
print("  throttle:", motor2.throttle)
print("  throttle:", motor3.throttle)
print("  throttle:", motor4.throttle)

print("\n***Motor test is complete***")

Credits

James Martel
48 projects • 63 followers
Self taught Robotics platform developer with electronics background
Contact

Comments

Please log in or sign up to comment.