eBoard ①⑧⑨
Written for SIA 2017/2018
eBoard 3.2d - shackle the Arduino!

YOU SHOULD READ [ ✍️ ] GENERAL INTRODUCTION THIS IS A WIP PAGE ;)

Warning
for the main car pin10 is locked and should not be used! it is used for SPI communication
Note
This code was written for the Arduino UNO R3 used with the Smart Servo Shield and allows to copy-paste Code running on a qfixSoccerboard
Warning
This code comes with absolutely no warranty
Precondition
This Header file was created to port Codes running on the qfix SoccerBoard [DynamixelBoard etc...] directly onto the Arduino UNO R3 [with Smart Servo Shield].
To use it you'll have to replace all qfix-related header-files [*.h] with the following:
It is possible to add this header as library aswell: [ ✍️ ] HOW TO SOURCE EBOARD FROM THE OFFICIAL ARDUINO LIBRARY MANAGER
#include <eBoard.h>
//manual: '#include "/path/to/eBoard.h"'

If you wan't to use the I2C extensions you should have this two lines the beginning of your code:

#define EBOARD_I2C 0x1

While in development you shouldn't disable any macro... If you change to release mode, write (as a minimum) the following before all includings:

#define EBOARD_DEBUG_MODE 0x0
Todo:
write nicer mainpage :D

Macros

There are multiple macros you can manipulate the behaviour of this header [full list is here: Macros and Constants]:

Note
The constants will appear with their default values in codeSnippets -> be careful with assumptions ;)

General

Identifier Requirement Meaning
[IGNORE_SIZE] Define via 'define' the size of this program will grow but the used variable-space will shrink...
[EBOARD_HELPCAR] Define via 'define' This will change motor setup etc. to the Helpcar and enable set_motor_speed() etc... This will change the behaviour of the SoccerBoard::motor() shortcut
EBOARD_DEBUG_MODE [DEBUGMODE] {int } Default: 9600 Sets the Serial debug speed for DEBUG
EBOARD_CHECK_PINS {bool} Default: 0x1 0x0: disables range-check for normal READ and WRITE.
EBOARD_CHECK_PINS_PWM {bool} Default: 0x1 0x0: disables range-check for PWM-WRITE
EBOARD_USE_SPI {bool} Default: 0x1 0x0: disables internal SPI-handling
EBOARD_USE_UTILITY {bool} Default: 0x1 removes useless code-parts [will vary on used board]
EBOARD_SPI_SERVO_MAX {int } Default: 2 Sets the amount of the visible, connected AX12Servo objects
EBOARD_I2C {bool} Default: 0x0 0x1: enables I2C tools
EBOARD_I2C_HELPER [I2C] {bool} Default: 0x0 0x1: enables I2C helper
EBOARD_SHIFT_REGISTER {bool} Default: 0x0 0x1: enables SHIFT_REGISTER
EBOARD_BLUETOOTH {bool} Default: 0x0 0x1: enables Bluetooth support
EBOARD_PWM_SPE {int } Default: 1 Sets the duty cycle for Async task execution
EBOARD_CLAMP {bool} Default: 0x1 0x0: disables clamp
EBOARD_USE_RESET {bool} Default: 0x1 0x0: disable software reset
EBOARD_LCD [I2C] {bool} Default: 0x0 0x1: enable support for LCD display. Needs EBOARD_I2C set to 0x1
EBOARD_NEO {bool} Default: 0x0 0x1: enable support for Adafruit-NeoPixel-Devices
EBOARD_GUESSPATH {bool} Default: 0x1 0x0: disable automatic path_guess this will increase the program size [manual includings necessary]
PREPROCESS_DEBUG {bool} Default: 0x0 0x1: enable preprocessing messages from eBoard

Pins

Identifier Default ID [UNO/NANO \ MEGA] Addiotional Information
PIN_BLUETOOTH_RX pinID(2\19) RX-Pin – why? [Version 1.2e 🐦 - On your command, master [~100m]]
PIN_BLUETOOTH_TX pinID(3\18) TX-Pin – why? [Version 1.2e 🐦 - On your command, master [~100m]]
PIN_MOTOR_DIR pinID(4) MotorControl [DIR]
PIN_MOTOR_SPE pinID(5) MotorControl [SPE]
PIN_SHIFT_CLK pinID(6) shift-Clock
PIN_SHIFT_DAT pinID(7) shift-Data
PIN_SHIFT_LAT pinID(8) shift-Latch
PIN_BLUETOOTH_STATE pinID(2\19) (if==RX-Pin: unset) if != RX-Pin: Pin of HC-05 connection-state
EBOARD_HELPCAR_MAIN [NANO] pin(13) data-Pin for the main Motor used for driving
EBOARD_HELPCAR_STEER [NANO] pin(12) data-Pin fot the steering Servo used for steering

Smart Servo Shield

sss.jpeg

This is the smart-servo shield this code was written for its connected by SPI with the UNO R3. In case of an emergency it is possible to hardcode a connection interface to drive the AX-12A Servo directly from the arduino... but this is very expensive :/

Note
to use the motors properly you have to connect the Board with a ~12V power supply!

Philosophy

On small projects I prefer the single-file header! \n Your able to 'manage the includings' via the preprocessor constants
The project got packed :D

Note
There is no internal reset command on the Arduino. To 'create' a remote reset mechanism use the onBoard Reset-Pin!

Async task execution

The Arduino is a single core processor. That means it isn't possible to do multiple tasks at once.
To enable async task execution eBoard provides this mechanism (write this before including the eBoard header!).
The execution cycle is EBOARD_PWM_SPE seconds and the method will be invoked after the resend of the Motor-PWM value.

#define REPT_TASK
void rept_task(void){
//do some stuff - non blocking!!!!
}
Warning
Don't put any endless loop etc. in this method! The execution time has to be lower than EBOARD_PWM_SPE seconds !

Take a look at this cool stability graph:

stabi.svg

Tutorials