mirror of
https://github.com/LinoSchmidt/RoboterArm.git
synced 2026-03-21 02:31:16 +01:00
roboterarm erte 2.0 version
This commit is contained in:
5
Firmware 2.0/.gitignore
vendored
Normal file
5
Firmware 2.0/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
7
Firmware 2.0/.vscode/extensions.json
vendored
Normal file
7
Firmware 2.0/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
]
|
||||
}
|
||||
3
Firmware 2.0/.vscode/settings.json
vendored
Normal file
3
Firmware 2.0/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"cmake.configureOnOpen": true
|
||||
}
|
||||
117
Firmware 2.0/SerialPort.ini
Normal file
117
Firmware 2.0/SerialPort.ini
Normal file
@@ -0,0 +1,117 @@
|
||||
[MainWindow]
|
||||
size=@Size(1920 1009)
|
||||
pos=@Point(-1 -8)
|
||||
activePanel=Plot
|
||||
hidePanels=false
|
||||
maximized=true
|
||||
state=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\a\x80\0\0\x3\xa6\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x3\0\0\0\f\0t\0\x62\0P\0l\0o\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x1a\0t\0\x62\0P\0o\0r\0t\0\x43\0o\0n\0t\0r\0o\0l\x1\0\0\0i\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x10\0t\0\x62\0R\0\x65\0\x63\0o\0r\0\x64\x1\0\0\x1\x8f\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
|
||||
|
||||
[Port]
|
||||
selectedPort=COM7
|
||||
baudRate=9600
|
||||
parity=none
|
||||
dataBits=8
|
||||
stopBits=1
|
||||
flowControl=none
|
||||
|
||||
[DataFormat]
|
||||
format=ascii
|
||||
|
||||
[DataFormat_Binary]
|
||||
numOfChannels=4
|
||||
numberFormat=uint8
|
||||
endianness=little
|
||||
|
||||
[DataFormat_ASCII]
|
||||
numOfChannels=auto
|
||||
delimiter=","
|
||||
customDelimiter=|
|
||||
filterMode=disabled
|
||||
filterPrefix=
|
||||
|
||||
[DataFormat_CustomFrame]
|
||||
numOfChannels=1
|
||||
numberFormat=uint8
|
||||
endianness=little
|
||||
frameStart=AA BB
|
||||
fixedSize=false
|
||||
frameSize=1
|
||||
checksum=false
|
||||
debugMode=false
|
||||
|
||||
[Channels]
|
||||
channel\1\name=Time
|
||||
channel\1\color=@Variant(\0\0\0\x43\x1\xff\xffUU\0\0\xff\xff\0\0)
|
||||
channel\1\visible=true
|
||||
channel\1\gain=1
|
||||
channel\1\gainEnabled=false
|
||||
channel\1\offset=0
|
||||
channel\1\offsetEnabled=false
|
||||
channel\2\name=Drehung
|
||||
channel\2\color=@Variant(\0\0\0\x43\x1\xff\xff\0\0\xff\xff\0\0\0\0)
|
||||
channel\2\visible=true
|
||||
channel\2\gain=1
|
||||
channel\2\gainEnabled=false
|
||||
channel\2\offset=0
|
||||
channel\2\offsetEnabled=false
|
||||
channel\3\name=Arm
|
||||
channel\3\color=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\xff\xff\0\0\0\0)
|
||||
channel\3\visible=true
|
||||
channel\3\gain=1
|
||||
channel\3\gainEnabled=false
|
||||
channel\3\offset=0
|
||||
channel\3\offsetEnabled=false
|
||||
channel\4\name=Oberarm
|
||||
channel\4\color=@Variant(\0\0\0\x43\x1\xff\xff\xfe\xfe\x89\x89\0\0\0\0)
|
||||
channel\4\visible=true
|
||||
channel\4\gain=1
|
||||
channel\4\gainEnabled=false
|
||||
channel\4\offset=0
|
||||
channel\4\offsetEnabled=false
|
||||
channel\5\name=Hand
|
||||
channel\5\color=@Variant(\0\0\0\x43\x1\xff\xff\xff\xff\0\0\0\0\0\0)
|
||||
channel\5\visible=true
|
||||
channel\5\gain=1
|
||||
channel\5\gainEnabled=false
|
||||
channel\5\offset=0
|
||||
channel\5\offsetEnabled=false
|
||||
channel\size=5
|
||||
|
||||
[Plot]
|
||||
numOfSamples=1000
|
||||
plotWidth=1000
|
||||
indexAsX=true
|
||||
xMax=1000
|
||||
xMin=0
|
||||
autoScale=true
|
||||
yMax=1000
|
||||
yMin=0
|
||||
darkBackground=false
|
||||
grid=false
|
||||
minorGrid=false
|
||||
legend=true
|
||||
multiPlot=false
|
||||
symbols=auto
|
||||
numLines=1000
|
||||
decimals=6
|
||||
|
||||
[Commands]
|
||||
command\1\name=Command 1
|
||||
command\1\type=ascii
|
||||
command\1\data=
|
||||
command\size=1
|
||||
|
||||
[Record]
|
||||
autoIncrement=true
|
||||
recordPaused=true
|
||||
stopOnClose=true
|
||||
header=true
|
||||
disableBuffering=false
|
||||
separator=","
|
||||
decimals=6
|
||||
timestamp=false
|
||||
timestampFormat=seconds
|
||||
|
||||
[UpdateCheck]
|
||||
periodicCheck=true
|
||||
lastCheck=2022-01-07
|
||||
39
Firmware 2.0/include/README
Normal file
39
Firmware 2.0/include/README
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
132
Firmware 2.0/include/sensorapi/sensorapi.pde
Normal file
132
Firmware 2.0/include/sensorapi/sensorapi.pde
Normal file
@@ -0,0 +1,132 @@
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_BMP085_U.h>
|
||||
|
||||
/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
|
||||
which provides a common 'type' for sensor data and some helper functions.
|
||||
|
||||
To use this driver you will also need to download the Adafruit_Sensor
|
||||
library and include it in your libraries folder.
|
||||
|
||||
You should also assign a unique ID to this sensor for use with
|
||||
the Adafruit Sensor API so that you can identify this particular
|
||||
sensor in any data logs, etc. To assign a unique ID, simply
|
||||
provide an appropriate value in the constructor below (12345
|
||||
is used by default in this example).
|
||||
|
||||
Connections
|
||||
===========
|
||||
Connect SCL to analog 5
|
||||
Connect SDA to analog 4
|
||||
Connect VDD to 3.3V DC
|
||||
Connect GROUND to common ground
|
||||
|
||||
History
|
||||
=======
|
||||
2013/JUN/17 - Updated altitude calculations (KTOWN)
|
||||
2013/FEB/13 - First version (KTOWN)
|
||||
*/
|
||||
|
||||
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
|
||||
|
||||
/**************************************************************************/
|
||||
/*
|
||||
Displays some basic information on this sensor from the unified
|
||||
sensor API sensor_t type (see Adafruit_Sensor for more information)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void displaySensorDetails(void)
|
||||
{
|
||||
sensor_t sensor;
|
||||
bmp.getSensor(&sensor);
|
||||
Serial.println("------------------------------------");
|
||||
Serial.print ("Sensor: "); Serial.println(sensor.name);
|
||||
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
|
||||
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
|
||||
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" hPa");
|
||||
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" hPa");
|
||||
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" hPa");
|
||||
Serial.println("------------------------------------");
|
||||
Serial.println("");
|
||||
delay(500);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*
|
||||
Arduino setup function (automatically called at startup)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(9600);
|
||||
Serial.println("Pressure Sensor Test"); Serial.println("");
|
||||
|
||||
/* Initialise the sensor */
|
||||
if(!bmp.begin())
|
||||
{
|
||||
/* There was a problem detecting the BMP085 ... check your connections */
|
||||
Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
|
||||
while(1);
|
||||
}
|
||||
|
||||
/* Display some basic information on this sensor */
|
||||
displaySensorDetails();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*
|
||||
Arduino loop function, called once 'setup' is complete (your own code
|
||||
should go here)
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void loop(void)
|
||||
{
|
||||
/* Get a new sensor event */
|
||||
sensors_event_t event;
|
||||
bmp.getEvent(&event);
|
||||
|
||||
/* Display the results (barometric pressure is measure in hPa) */
|
||||
if (event.pressure)
|
||||
{
|
||||
/* Display atmospheric pressue in hPa */
|
||||
Serial.print("Pressure: ");
|
||||
Serial.print(event.pressure);
|
||||
Serial.println(" hPa");
|
||||
|
||||
/* Calculating altitude with reasonable accuracy requires pressure *
|
||||
* sea level pressure for your position at the moment the data is *
|
||||
* converted, as well as the ambient temperature in degress *
|
||||
* celcius. If you don't have these values, a 'generic' value of *
|
||||
* 1013.25 hPa can be used (defined as SENSORS_PRESSURE_SEALEVELHPA *
|
||||
* in sensors.h), but this isn't ideal and will give variable *
|
||||
* results from one day to the next. *
|
||||
* *
|
||||
* You can usually find the current SLP value by looking at weather *
|
||||
* websites or from environmental information centers near any major *
|
||||
* airport. *
|
||||
* *
|
||||
* For example, for Paris, France you can check the current mean *
|
||||
* pressure and sea level at: http://bit.ly/16Au8ol */
|
||||
|
||||
/* First we get the current temperature from the BMP085 */
|
||||
float temperature;
|
||||
bmp.getTemperature(&temperature);
|
||||
Serial.print("Temperature: ");
|
||||
Serial.print(temperature);
|
||||
Serial.println(" C");
|
||||
|
||||
/* Then convert the atmospheric pressure, and SLP to altitude */
|
||||
/* Update this next line with the current SLP for better results */
|
||||
float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;
|
||||
Serial.print("Altitude: ");
|
||||
Serial.print(bmp.pressureToAltitude(seaLevelPressure,
|
||||
event.pressure));
|
||||
Serial.println(" m");
|
||||
Serial.println("");
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Sensor error");
|
||||
}
|
||||
delay(1000);
|
||||
}
|
||||
46
Firmware 2.0/lib/README
Normal file
46
Firmware 2.0/lib/README
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <Adafruit_I2CDevice.h>
|
||||
|
||||
Adafruit_I2CDevice i2c_dev = Adafruit_I2CDevice(0x10);
|
||||
|
||||
void setup() {
|
||||
while (!Serial) { delay(10); }
|
||||
Serial.begin(115200);
|
||||
Serial.println("I2C address detection test");
|
||||
|
||||
if (!i2c_dev.begin()) {
|
||||
Serial.print("Did not find device at 0x");
|
||||
Serial.println(i2c_dev.address(), HEX);
|
||||
while (1);
|
||||
}
|
||||
Serial.print("Device found on address 0x");
|
||||
Serial.println(i2c_dev.address(), HEX);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
29
Firmware 2.0/lib/examples/spi_modetest/spi_modetest.ino
Normal file
29
Firmware 2.0/lib/examples/spi_modetest/spi_modetest.ino
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <Adafruit_SPIDevice.h>
|
||||
|
||||
#define SPIDEVICE_CS 10
|
||||
Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS, 100000, SPI_BITORDER_MSBFIRST, SPI_MODE1);
|
||||
//Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS, 13, 12, 11, 100000, SPI_BITORDER_MSBFIRST, SPI_MODE1);
|
||||
|
||||
|
||||
void setup() {
|
||||
while (!Serial) { delay(10); }
|
||||
Serial.begin(115200);
|
||||
Serial.println("SPI device mode test");
|
||||
|
||||
if (!spi_dev.begin()) {
|
||||
Serial.println("Could not initialize SPI device");
|
||||
while (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Serial.println("\n\nTransfer test");
|
||||
for (uint16_t x=0; x<=0xFF; x++) {
|
||||
uint8_t i = x;
|
||||
Serial.print("0x"); Serial.print(i, HEX);
|
||||
spi_dev.read(&i, 1, i);
|
||||
Serial.print("/"); Serial.print(i, HEX);
|
||||
Serial.print(", ");
|
||||
delay(25);
|
||||
}
|
||||
}
|
||||
34
Firmware 2.0/lib/examples/spi_registers/spi_registers.ino
Normal file
34
Firmware 2.0/lib/examples/spi_registers/spi_registers.ino
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <Adafruit_BusIO_Register.h>
|
||||
#include <Adafruit_SPIDevice.h>
|
||||
|
||||
#define SPIDEVICE_CS 10
|
||||
Adafruit_SPIDevice spi_dev = Adafruit_SPIDevice(SPIDEVICE_CS);
|
||||
|
||||
void setup() {
|
||||
while (!Serial) { delay(10); }
|
||||
Serial.begin(115200);
|
||||
Serial.println("SPI device register test");
|
||||
|
||||
if (!spi_dev.begin()) {
|
||||
Serial.println("Could not initialize SPI device");
|
||||
while (1);
|
||||
}
|
||||
|
||||
Adafruit_BusIO_Register id_reg = Adafruit_BusIO_Register(&spi_dev, 0x0F, ADDRBIT8_HIGH_TOREAD);
|
||||
uint8_t id;
|
||||
id_reg.read(&id);
|
||||
Serial.print("ID register = 0x"); Serial.println(id, HEX);
|
||||
|
||||
Adafruit_BusIO_Register thresh_reg = Adafruit_BusIO_Register(&spi_dev, 0x0C, ADDRBIT8_HIGH_TOREAD, 2, LSBFIRST);
|
||||
uint16_t thresh;
|
||||
thresh_reg.read(&thresh);
|
||||
Serial.print("Initial threshold register = 0x"); Serial.println(thresh, HEX);
|
||||
|
||||
thresh_reg.write(~thresh);
|
||||
|
||||
Serial.print("Post threshold register = 0x"); Serial.println(thresh_reg.read(), HEX);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
15
Firmware 2.0/platformio.ini
Normal file
15
Firmware 2.0/platformio.ini
Normal file
@@ -0,0 +1,15 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:leonardo]
|
||||
platform = atmelavr
|
||||
board = leonardo
|
||||
framework = arduino
|
||||
lib_deps = arduino-libraries/Servo @ ^1.1.8
|
||||
140
Firmware 2.0/src/main.cpp
Normal file
140
Firmware 2.0/src/main.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
#include <Arduino.h>
|
||||
#include <Servo.h>
|
||||
|
||||
|
||||
#define Debug true //----------------------------------Ausschalten Wichtig! (Nur für testzwecke)---------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//--------------------------> Einstellungen <-----------------------
|
||||
//------------------------------------------------------------------
|
||||
|
||||
#define DrehungPin 9
|
||||
#define ArmPin 10
|
||||
#define OberarmPin 11
|
||||
#define HandPin 12
|
||||
|
||||
#define DrehungMax 145
|
||||
#define DrehungMin 0
|
||||
|
||||
#define ArmMax 180
|
||||
#define ArmMin 0
|
||||
|
||||
#define OberarmMax 180
|
||||
#define OberarmMin 0
|
||||
|
||||
#define HandMax 140
|
||||
#define HandMin 45
|
||||
|
||||
#define Drehung_Start 135
|
||||
#define Arm_Start 180
|
||||
#define Oberarm_Start 111
|
||||
#define Hand_Start 0
|
||||
|
||||
|
||||
#define joystick_LX_Pin 0
|
||||
#define joystick_LY_Pin 1
|
||||
#define joystick_RX_Pin 2
|
||||
#define joystick_RY_Pin 3
|
||||
|
||||
#define joystick_LX_middle 511
|
||||
#define joystick_LY_middle 511
|
||||
#define joystick_RX_middle 511
|
||||
#define joystick_RY_middle 511
|
||||
|
||||
#define joystickMax 1023
|
||||
#define joystickMin 0
|
||||
|
||||
#define joystick_Empfindlichkeit 2
|
||||
#define joystick_MaxSpeed 10
|
||||
#define joystick_MinSpeed 1
|
||||
|
||||
#define LoopTime 25
|
||||
|
||||
#define TimeToAutoplay 500
|
||||
#define TimeToDetach 80
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
|
||||
Servo Drehung, Arm, Oberarm, Hand;
|
||||
|
||||
int joystick_LX, joystick_LY, joystick_RX, joystick_RY;
|
||||
int DrehungPos = Drehung_Start, ArmPos = Arm_Start, OberarmPos = Oberarm_Start, HandPos = Hand_Start;
|
||||
|
||||
int offtime = 0;
|
||||
bool detached = true;
|
||||
|
||||
void setup(){
|
||||
if(Debug)Serial.begin(9600);
|
||||
}
|
||||
|
||||
int joystick_position(int joystick, int joystick_middle, int joystick_min, int joystick_max){
|
||||
if(joystick <= joystick_middle - joystick_Empfindlichkeit)
|
||||
return(map(joystick, joystick_middle - joystick_Empfindlichkeit, joystick_min, joystick_MinSpeed, joystick_MaxSpeed));
|
||||
else if(joystick >= joystick_middle + joystick_Empfindlichkeit)
|
||||
return(map(joystick, joystick_middle + joystick_Empfindlichkeit, joystick_max, joystick_MinSpeed, joystick_MaxSpeed));
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
void loop(){
|
||||
joystick_LX = joystick_position(analogRead(HandPin), joystick_LX_middle, joystickMin, joystickMin);
|
||||
joystick_LY = joystick_position(analogRead(OberarmPin), joystick_LY_middle, joystickMin, joystickMin);
|
||||
joystick_RX = joystick_position(analogRead(DrehungPin), joystick_RX_middle, joystickMin, joystickMin);
|
||||
joystick_RY = joystick_position(analogRead(ArmPin), joystick_RY_middle, joystickMin, joystickMin);
|
||||
|
||||
if(joystick_LX == 0 && joystick_LY == 0 && joystick_RX == 0 && joystick_RY == 0){
|
||||
if (TimeToAutoplay > offtime)
|
||||
offtime++;
|
||||
}
|
||||
else{
|
||||
offtime = 0;
|
||||
if(detached){
|
||||
Drehung.attach(DrehungPin);
|
||||
Arm.attach(ArmPin);
|
||||
Oberarm.attach(OberarmPin);
|
||||
Hand.attach(HandPin);
|
||||
|
||||
detached = false;
|
||||
}
|
||||
|
||||
if(joystick_LX != 0)
|
||||
HandPos += joystick_LX;
|
||||
if(joystick_LY != 0)
|
||||
OberarmPos += joystick_LY;
|
||||
if(joystick_RX != 0)
|
||||
DrehungPos += joystick_RX;
|
||||
if(joystick_RY != 0)
|
||||
ArmPos += joystick_RY;
|
||||
|
||||
|
||||
if(HandPos > HandMax)HandPos = HandMax;
|
||||
if(OberarmPos > OberarmMax)HandPos = OberarmMax;
|
||||
if(DrehungPos > DrehungMax)HandPos = DrehungMax;
|
||||
if(ArmPos > ArmMax)HandPos = ArmMax;
|
||||
|
||||
if(HandPos < HandMin)HandPos = HandMin;
|
||||
if(OberarmPos < OberarmMin)HandPos = OberarmMin;
|
||||
if(DrehungPos < DrehungMin)HandPos = DrehungMin;
|
||||
if(ArmPos < ArmMin)HandPos = ArmMin;
|
||||
|
||||
Drehung.write(DrehungPos);
|
||||
Arm.write(ArmPos);
|
||||
Oberarm.write(OberarmPos);
|
||||
Hand.write(HandPos);
|
||||
}
|
||||
|
||||
if(offtime <= TimeToDetach){
|
||||
Drehung.detach();
|
||||
Arm.detach();
|
||||
Oberarm.detach();
|
||||
Hand.detach();
|
||||
|
||||
detached = true;
|
||||
}
|
||||
|
||||
if(Debug)Serial.println(String(offtime) + "," + String(DrehungPos) + "," + String(ArmPos) + "," + String(OberarmPos) + "," + String(HandPos));
|
||||
|
||||
delay(LoopTime);
|
||||
}
|
||||
11
Firmware 2.0/test/README
Normal file
11
Firmware 2.0/test/README
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PlatformIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
Reference in New Issue
Block a user