Spyder or thonny6/21/2023 This program will print ultrasonic distance in the unit of cm on the Thonny shell.įollow the steps from "Move Forward" and add the code below. import time import board import adafruit_hcsr04 sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.GP2, echo_pin=board.GP3) while True: print((sonar.distance,)) time.sleep(0.1) import board import digitalio import simpleio import time import pwmio from adafruit_motor import servo, motor # Initialize DC motors m1a = pwmio.PWMOut(board.GP8, frequency=10000) m1b = pwmio.PWMOut(board.GP9, frequency=10000) motor1 = motor.DCMotor(m1a, m1b) m2a = pwmio.PWMOut(board.GP10, frequency=10000) m2b = pwmio.PWMOut(board.GP11, frequency=10000) motor2 = motor.DCMotor(m2a, m2b) # Brake motor1.throttle = 0 # motor1.throttle = 1 or -1 for full speed motor2.throttle = 0įollow the steps from "Move Forward" and add the code below. import board import digitalio import simpleio import time import pwmio from adafruit_motor import servo, motor # Initialize DC motors m1a = pwmio.PWMOut(board.GP8, frequency=10000) m1b = pwmio.PWMOut(board.GP9, frequency=10000) motor1 = motor.DCMotor(m1a, m1b) m2a = pwmio.PWMOut(board.GP10, frequency=10000) m2b = pwmio.PWMOut(board.GP11, frequency=10000) motor2 = motor.DCMotor(m2a, m2b) # Move motors at 50% speed motor1.throttle = 0.5 # motor1.throttle = 1 or -1 for full speed motor2.throttle = 0.5įollow the steps from "Move Forward" and add the code below. import board import digitalio import simpleio import time import pwmio from adafruit_motor import servo, motor # Initialize DC motors m1a = pwmio.PWMOut(board.GP8, frequency=10000) m1b = pwmio.PWMOut(board.GP9, frequency=10000) motor1 = motor.DCMotor(m1a, m1b) m2a = pwmio.PWMOut(board.GP10, frequency=10000) m2b = pwmio.PWMOut(board.GP11, frequency=10000) motor2 = motor.DCMotor(m2a, m2b) # Move motors at 50% speed motor1.throttle = -0.5 # motor1.throttle = 1 or -1 for full speed motor2.throttle = -0.5įollow the steps from "Move Forward" and add the code below. import board import digitalio import simpleio import time import pwmio from adafruit_motor import servo, motor # Initialize DC motors m1a = pwmio.PWMOut(board.GP8, frequency=10000) m1b = pwmio.PWMOut(board.GP9, frequency=10000) motor1 = motor.DCMotor(m1a, m1b) m2a = pwmio.PWMOut(board.GP10, frequency=10000) m2b = pwmio.PWMOut(board.GP11, frequency=10000) motor2 = motor.DCMotor(m2a, m2b) # Move motors at 50% speed motor1.throttle = -0.5 # motor1.throttle = 1 or -1 for full speed motor2.throttle = 0.5įollow the steps from "Move Forward" and add the code below. The robot will move forward.įollow the steps from "Move Forward" and add the code below. Turn on the robot by using the switch at battery holder. Analog output also offers higher resolution compared to individual digital outputs. Maker Line also supports dual outputs: 5 x digital outputs for the state of each sensor independently which is similar to conventional IR sensor, but you get the benefit of easy calibration One analog output where its voltage represents the line position. Maker line is a easy and beginner-friendly line sensor. Maker Drive has 4 Test Buttons (2 for each channel), 4 Indicator LEDs (2 for each channel). ![]() Maker Drive is designed to be compact, roughly the size of a passport photo. ![]() Maker Drive is designed for simplicity and with the beginner in mind. Maker Drive is a easy and beginner-friendly motor driver. The bottom layer of this board even comes with a comprehensive pinout diagram showing the function of each pin. Each GPIO is coupled with an LED indicator for convenient code testing and troubleshooting. Maker Pi Pico gives you access to all Raspberry Pi Pico's pins on two 20 ways pin headers, with clear labels. Maker Pi Pico is Raspberry Pi Pico's extension board developed by Cytron Technologies. It is also based on the 1st Microcontroller IC/Silicon - RP2040, designed and produced by Engineers from the Raspberry Pi team too. ![]() Raspberry Pi Pico is the 1st Microcontroller Development Board from Raspberry Pi Foundation.
0 Comments
Leave a Reply. |