Skip to content

Commit

Permalink
Examples and new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Oct 6, 2020
1 parent 3543dd8 commit 3575b5e
Show file tree
Hide file tree
Showing 29 changed files with 1,690 additions and 1,122 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/LibraryBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ jobs:
#############################################################################################################
arduino-boards-fqbn:
- arduino:avr:uno
# - arduino:avr:leonardo
# - arduino:avr:mega
# - arduino:megaavr:nona4809:mode=off
# - arduino:sam:arduino_due_x
# - arduino:samd:arduino_zero_native
# - esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
# - esp32:esp32:featheresp32:FlashFreq=80
# - STM32:stm32:GenF1:pnum=BLUEPILL_F103C8
# - stm32duino:STM32F1:genericSTM32F103C
# - SparkFun:apollo3:amap3nano

# Specify parameters for each board.
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list.
Expand All @@ -64,67 +54,6 @@ jobs:
-DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN
-DENABLE_MOTOR_LIST_FUNCTIONS

# - arduino-boards-fqbn: arduino:avr:leonardo
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN

# - arduino-boards-fqbn: arduino:avr:mega
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: arduino:megaavr:nona4809:mode=off
# sketches-exclude: SpeedTest,EndPositionsTest,QuadrupedControl,RobotArmControl # No getVCCVoltageMillivolt(), no EasyButton
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: arduino:sam:arduino_due_x
# sketches-exclude: QuadrupedControl,RobotArmControl # QuadrupedControl RobotArmControl because of missing EEprom
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: arduino:samd:arduino_zero_native
# sketches-exclude: QuadrupedControl,RobotArmControl
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
# platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
# sketches-exclude: QuadrupedControl,RobotArmControl,SpeedTest # SpeedTest because of only one analog input
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
# platform-url: https://dl.espressif.com/dl/package_esp32_index.json
# sketches-exclude: QuadrupedControl,RobotArmControl # Comma separated list of (unique substrings of) example names to exclude in build
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # STM version
# platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
# sketches-exclude: QuadrupedControl,RobotArmControl
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C # Roger Clark version
# platform-url: http://dan.drown.org/stm32duino/package_STM32duino_index.json
# sketches-exclude: QuadrupedControl,RobotArmControl
# build-properties:
# RobotCarBlueDisplay: -DBLUETOOTH_BAUD_RATE=BAUD_115200 -DUSE_STANDARD_SERIAL -DUSE_US_SENSOR_1_PIN_MODE -DDISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN


# - arduino-boards-fqbn: SparkFun:apollo3:amap3nano
# platform-url: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
# # 4/2020 For PCA9685_Expander, Wire cannot be found in cli, it works in the regular IDE. SpeedTest and EndPositionsTest give strange BFD assertions
# sketches-exclude: QuadrupedControl,RobotArmControl,PCA9685_Expander,PCA9685_ExpanderAndServo,PCA9685_ExpanderFor32Servos,SpeedTest,EndPositionsTest


# Do not cancel all jobs / architectures if one job fails
fail-fast: false

Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ Available as Arduino library "PWMMotorControl"
### [Version 1.0.0](https://github.com/ArminJo/PWMMotorControl/releases)

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Installation instructions](https://www.ardu-badge.com/badge/PWMMotorControl.svg?)](https://www.ardu-badge.com/PWMMotorControl)
[![Commits since latest](https://img.shields.io/github/commits-since/ArminJo/PWMMotorControl/latest)](https://github.com/ArminJo/PWMMotorControl/commits/master)
[![Build Status](https://github.com/ArminJo/PWMMotorControl/workflows/LibraryBuild/badge.svg)](https://github.com/ArminJo/PWMMotorControl/actions)
![Hit Counter](https://visitor-badge.laobi.icu/badge?page_id=ArminJo_PWMMotorControl)

- The PWMDcMotor.cpp controls **brushed DC motors** by PWM using standard full bridge IC's like **L298**, **TB6612** (new low loss dual full bridge IC), or **Adafruit_MotorShield** (using PCA9685 -> 2 x TB6612).
- The EncoderMotor.cpp.cpp controls a DC motor with attached encoder disc and fork light barrier to enable **driving a specified distance**.
- The EncoderMotor.cpp.cpp controls a DC motor with attached encoder disc and slot-type photo interrupters to enable **driving a specified distance**.
- The CarMotorControl.cpp controls **2 motors simultaneously** like it is required for most **Robot Cars**.

Basic commands are:
Expand All @@ -30,8 +32,8 @@ Some options which are enabed by default can be disabled by defining a *inhibit*

| Macro | Default | File | Description |
|-|-|-|-|
| `USE_ENCODER_MOTOR_CONTROL` | disabled | PWMDCMotor.h | Use fork light barrier and an attached encoder disc to enable motor distance and speed sensing for closed loop control. |
| `USE_ADAFRUIT_MOTOR_SHIELD` | disabled | PWMDcMotor.h | Use Adafruit Motor Shield v2 connected by I2C instead of simple TB6612 or L298 breakout board.<br/>This disables tone output by using motor as loudspeaker, but requires only 2 I2C/TWI pins in contrast to the 6 pins used for the full bride.<br/>For full bride, analogWrite the millis() timer0 is used since we use pin 5 & 6. |
| `USE_ENCODER_MOTOR_CONTROL` | disabled | PWMDCMotor.h | Use slot-type photo interrupter and an attached encoder disc to enable motor distance and speed sensing for closed loop control. |
| `USE_ADAFRUIT_MOTOR_SHIELD` | disabled | PWMDcMotor.h | Use Adafruit Motor Shield v2 connected by I2C instead of simple TB6612 or L298 breakout board.<br/>This disables tone output by using motor as loudspeaker, but requires only 2 I2C/TWI pins in contrast to the 6 pins used for the full bridge.<br/>For full bridge, analogWrite the millis() timer0 is used since we use pin 5 & 6. |
| `USE_OWN_LIBRARY_FOR_`<br/>`ADAFRUIT_MOTOR_SHIELD` | enabled | PWMDcMotor.h | Saves around 694 bytes program memory.<br/>Disable macro=`USE_STANDARD_LIBRARY_`<br/>`FOR_ADAFRUIT_MOTOR_SHIELD` |
| `SUPPORT_RAMP_UP` | enabled | PWMDcMotor.h | Saves around 300 bytes program memory.<br/>Disable macro=`DO_NOT_SUPPORT_RAMP_UP` |

Expand All @@ -50,7 +52,7 @@ These values are used by functions and the first 2 can be overwritten by set* fu
|-|-|-|-|
| `DEFAULT_START_SPEED` | 45/150 for 7.4/6.0 volt supply | PWMDCMotor.h | START_SPEED is the speed PWM value at which car starts to move. |
| `DEFAULT_DRIVE_SPEED` | 80/255(max speed) for 7.4/6.0 volt supply | PWMDCMotor.h | The speed PWM value for going fixed distance. |
| `DEFAULT_DISTANCE_TO_TIME_FACTOR` | 135/300 for 7.4/6.0 volt supply | PWMDCMotor.h | The factor used to convert distance in 5mm steps to motor on time in milliseconds using the formula:<br/>`computedMillisOf`<br/>`MotorStopForDistance = 150 + (10 * ((aDistanceCount * DistanceToTimeFactor) / DriveSpeed))` |
| `DEFAULT_DISTANCE_TO_TIME_FACTOR` | 135/300 for 7.4/6.0 volt supply | PWMDCMotor.h | The factor used to convert distance in 5mm steps to motor on time in milliseconds using the formula:<br/>`computedMillisOf`<br/>`MotorStopForDistance = 150 + (10 * ((aRequestedDistanceCount * DistanceToTimeFactor) / DriveSpeed))` |
| `RAMP_UP_UPDATE_INTERVAL_MILLIS` | 16 | PWMDCMotor.h | The smaller the value the steeper the ramp. |
| `RAMP_UP_UPDATE_INTERVAL_STEPS` | 16 | PWMDCMotor.h | Results in a ramp up time of 16 steps * 16 millis = 256 milliseconds. |

Expand Down Expand Up @@ -79,8 +81,8 @@ To customize the RobotCar example to cover different extensions, there are some
![2 wheel car](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/2WheelDriveCar.jpg)
4 wheel car, like 2 WD car before, but with servo mounted head up.
![4 wheel car](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/4WheelDriveCar.jpg)
Encoder fork sensor
![Encoder fork sensor](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/ForkSensor.jpg)
Encoder slot-type photo interrupter sensor
![Encoder slot-type photo interrupter sensor](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/ForkSensor.jpg)
Servo mounted head down
![Servo mounting](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/ServoAtTopBack.jpg)
VIN sensing
Expand All @@ -100,6 +102,9 @@ Automatic control page with detected wall at right
- The tiny black bar is the rotation chosen by doCollisionDetection() function.

# Revision History
### Version 1.1.0
- Added and renamed functions.

### Version 1.0.0
Initial Arduino library version
Initial Arduino library version.

214 changes: 0 additions & 214 deletions examples/RobotCarBasic/RobotCar.h

This file was deleted.

1 change: 1 addition & 0 deletions examples/RobotCarBasic/RobotCarBasic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* armin.joachimsmeyer@gmail.com
*
* This file is part of Arduino-RobotCar https://github.com/ArminJo/Arduino-RobotCar.
* This file is part of PWMMotorControl https://github.com/ArminJo/PWMMotorControl.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
Expand Down
Loading

0 comments on commit 3575b5e

Please sign in to comment.