Jump to content
  • 0

Lwclone On Arduino Mega 2560


cyclemat

Question

Here comes the LWClone on Arduino MEGA 2560

 

How to Compile

Windows Prerequisites

On Windows, you will need a copy of the latest Atmel Toolchain, either downloaded 
and installed as a standalone package, or installed as part of Atmel Studio. 
You will need to ensure that the "bin" directory of the toolchain is available 
in your system's PATH environment variable.

In addition, you will need to install a ported version of the ZSH or BASH *nix shells, 
and a standard set of *nix utilities such as cut, find and sed. 
These can be found in the "basic" system package of the of the MinGW installer (http://www.mingw.org). 
Once installed, add the "msys\1.0\bin" of the MinGW installation folder is added 
to your system's PATH environment variable.

The bootloaders currently also require the "bc" application, 
which can be installed from http://gnuwin32.sourceforge.net/downlinks/bc.php. 
Once installed add the "GnuWin32\bin" path of the GnuWin32 installation folder 
to your system's PATH environment variable.

Linux Prerequisites

On Linux systems you will need to install the latest Linux distribution 
of the standalone Atmel Toolchain from the Atmel website for general development, 
or use the latest avr-libc and avr-gcc packages for your chosen distribution's package 
manager. For full device support, the Atmel standalone package is recommended.

How 2 Flash

Connect your Arduino to USB and look witch comport it has
Start Flash Main Chip Arduino Mega to LW.bat
enter your Comport e.g com2 or com32 what ever
Remove USB
Connect your USBASP to the ISP header behind the USB port
Start Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to LW.bat
Connect The USB port wait for reorgination the Device 
Start Change ArduLW ID.bat
Enter your LEDWIZ ID e.g. 1 or 2 up to 16
That is it test it with Visualpinball an Pinmame/DOF

 have make New packages 23.01.2016

 

https://mega.nz/#F!bdZHVaxK!3WmePgTED-3xQp8oj-ZfOA

 

one package with inverted LED ports so that High ist normal and low is on ( for the Relaisboards from ebay)

 

 

For Boards that say it gives problems with The STK500 Timeout Error Here ist a Short way to fix it !?!?

 

 

1. Connect the USBASP to the ISP connector behind the USB Port.

2.Start the  "0. Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to Arduino.bat"

 

3. Connect the USBASP to the Second ISP port

4. Start the "Flash m2560 Unlock fuses, erase, verify - with USBASP Dongle.bat"

5. Start the "Flash m2560 Write the bootloader, set the lock fuse, verify  - with USBASP Dongle.bat"

 

 

Now you can flash it normaly

 

when the flash with the USB ASP didnt work test to bridge the GND point on the 10->6 Pole Converter

 

FOR HELP PLEASE POST YOUR PINMAP.H AS CODE AND WHEN YOU HAVE COMPILING PROBLEMS POST YOUR OUTPUT AS CODE SO I CAN BETTER

HELP

 

So have make a little Video tutorial don`t say anything about my english have do my best.

 

 

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

so after redownloading and flashing the new code there´s poorly no change for me and the behavior is like i described it in post #48

also try´ed different id´s and to delete all the FAFA entries in the registry but that didn´t helped.

Only change is that now a Windows sound come´s when i unplug or plug it in that was not there before. But in the tool and DOF i always have to disconect and conect it to make it work

Link to comment
Share on other sites

  • 0

my friend has found the time to change a little bit I test it then i Compile a new archive

 

when the test ist finished the git will be updated. for everybody who cant ait here is the diff

 firmware/comm.c     | 4 ++--
 firmware/main_usb.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/firmware/comm.c b/firmware/comm.c
index 432b61f..2e02fcf 100644
--- a/firmware/comm.c
+++ b/firmware/comm.c
@@ -227,7 +227,7 @@ void sleep_ms(uint16_t ms)
 
 #if defined(DATA_TX_UART_vect)
 
-CREATE_FIFO(g_txfifo, 0, 6)
+CREATE_FIFO(g_txfifo, 2, 4)
 
 msg_t* msg_prepare(void)
 {
@@ -302,7 +302,7 @@ ISR(DATA_TX_UART_vect)
 
 #if defined(DATA_RX_UART_vect)
 
-CREATE_FIFO(g_rxfifo, 0, 6)
+CREATE_FIFO(g_rxfifo, 2, 4)
 
 msg_t* msg_recv(void)
 {
diff --git a/firmware/main_usb.c b/firmware/main_usb.c
index 525daca..c5869ac 100644
--- a/firmware/main_usb.c
+++ b/firmware/main_usb.c
@@ -303,6 +303,9 @@ void EVENT_USB_Device_ControlRequest(void)
 			}
 			else
 			{
+				uint8_t temp[8];
+				Endpoint_Read_Control_Stream_LE(temp, 8); // drop data
+
 				DbgOut(DBGERROR, "HID_REQ_SetReport: buffer overflow");
 			}
 
 
Link to comment
Share on other sites

  • 0

why i make pinmap saples on the first side and wich arduino do you use ?

 

this is for the Mega2560

 

 

and set only 1 Joystick and use the Regedit fix

 

Joystick FIX

 

When you have problems with an empty Joystick ore Something ele the problem is on Windows windows Save the properties of joysticks and don`t change it when you change the config of your device so you must delete the settings with regedit hope the pictures helps to understand.

 

https://www.dropbox.com/s/fjxkynj7usu2tci/joystick_fix_1.png?dl=0

 

https://www.dropbox.com/s/1s9cmeoswpvgjyn/joystick_regedit_1.png?dl=0

 

https://www.dropbox.com/s/eyou6i21qdbzxse/joystick_regedit_2.png?dl=0

 

https://www.dropbox.com/s/ndbal9gysjwxgt9/joystick_regedit_3.png?dl=0

 

Here are the code!

		_map_( F, 0, 0x00, 0.000, 1.000, ID_AccelGyro, 0 ) /* Analog Pin 0 */ \
		_map_( F, 1, 0x01, 0.000, 1.000, ID_AccelGyro, 1 ) /* Analog Pin 1 */ \
		_map_( F, 2, 0x02, 0.000, 1.000, ID_AccelGyro, 2 ) /* Analog Pin 2 */ \
		_map_( F, 3, 0x03, 0.000, 1.000, ID_AccelGyro, 3 ) /* Analog Pin 3 */ \
		_map_( F, 4, 0x04, 0.000, 1.000, ID_AccelGyro, 4 ) /* Analog Pin 4 */ \
		_map_( F, 5, 0x05, 0.000, 1.000, ID_AccelGyro, 5 ) /* Analog Pin 5 */ \
	\

Link to comment
Share on other sites

  • 0

Hi.

 

I need help with this. I flashed my mega with the lwclone software and everything went smoothly. I can change the id of my "ledwiz" and it gets detected as a ledwiz in the ledblinky and ledwiz software.

The problem is that it doesn't do anything. I've connected a small realy-board(driven via opto-couplers) and verified that that the relays are working just fine but I can't activate the relays from any of the softwares.

 

I have literally tried every ouput-pin. The led connected to pin 13 is always on , is it supposed to be like that??

Just to be sure that the arduino wasn't faulty I reflashed it with the arduino bootloader and uploaded a small sketch that worked just fine. In fact I used the realy-board when I did that so I know everything is working and is correctly connected. 

 

Any thoughts about waht could be my problem??

Link to comment
Share on other sites

  • 0

Hi.

 

I need help with this. I flashed my mega with the lwclone software and everything went smoothly. I can change the id of my "ledwiz" and it gets detected as a ledwiz in the ledblinky and ledwiz software.

The problem is that it doesn't do anything. I've connected a small realy-board(driven via opto-couplers) and verified that that the relays are working just fine but I can't activate the relays from any of the softwares.

 

I have literally tried every ouput-pin. The led connected to pin 13 is always on , is it supposed to be like that??

Just to be sure that the arduino wasn't faulty I reflashed it with the arduino bootloader and uploaded a small sketch that worked just fine. In fact I used the realy-board when I did that so I know everything is working and is correctly connected. 

 

Any thoughts about waht could be my problem??

 

please post a picture of your relais board and you pinmap.h 

 

have you flash the mainchip via usb asp or via USB?

 

ist you relais board a 5v or a 12v from ebay ? 

Link to comment
Share on other sites

  • 0

So after my GY61 finally arrived (the first one i ordered got lost on the postway) i got some time to test but i ran into a problem.

When i use the hex codes included in your latest package all works great and my computer is showing a joystick with x,y,z and xr,yr,zr

But i need another pinmap for the ledwiz part and want to test some other values for the analog axes so i tried a self compiled hex.

The compiling went well without errors but when i flash it to my mega i will only get a joystick with an x and y axes. the other axes are missing completly. so is there a trick or something i have to do except adding the "#define ENABLE_ANALOG_INPUT" to the devconfig.h ?

here´s my devconfig.h 

/*
 * LWCloneU2
 * Copyright (C) 2013 Andreas Dittrich <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef DEVCONFIG_H__INCLUDED
#define DEVCONFIG_H__INCLUDED


/****************************************
 USB device config
****************************************/

#define ENABLE_LED_DEVICE

#define ENABLE_PANEL_DEVICE
#define NUM_JOYSTICKS 1
#define USE_MOUSE 0
#define USE_CONSUMER 1
#define USE_KEYBOARD 1
#define ENABLE_ANALOG_INPUT

#endif

also tested with "#define NUM_JOYSTICKS 2" but this didn´t helped

and the pinmap.h looks like this

/*
 * LWCloneU2
 * Copyright (C) 2013 Andreas Dittrich <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#define LED_MAPPING_TABLE(_map_) \
	\
	_map_( A, 0, 0 ) /* ( AD0 )               Digital pin 22 */ \
	_map_( A, 1, 0 ) /* ( AD1 )               Digital pin 23 */ \
	_map_( A, 2, 0 ) /* ( AD2 )               Digital pin 24 */ \
	_map_( A, 3, 0 ) /* ( AD3 )               Digital pin 25 */ \
	_map_( A, 4, 0 ) /* ( AD4 )               Digital pin 26 */ \
	_map_( A, 5, 0 ) /* ( AD5 )               Digital pin 27 */ \
	_map_( A, 6, 0 ) /* ( AD6 )               Digital pin 28 */ \
	_map_( A, 7, 0 ) /* ( AD7 )               Digital pin 29 */ \
	_map_( C, 7, 0 ) /* ( A15 )               Digital pin 30 */ \
	_map_( C, 6, 0 ) /* ( A14 )               Digital pin 31 */ \
	_map_( C, 5, 0 ) /* ( A13 )               Digital pin 32 */ \
	_map_( C, 4, 0 ) /* ( A12 )               Digital pin 33 */ \
	_map_( C, 3, 0 ) /* ( A11 )               Digital pin 34 */ \
	_map_( C, 2, 0 ) /* ( A10 )               Digital pin 35 */ \
	_map_( C, 1, 0 ) /* ( A9 )                Digital pin 36 */ \
	_map_( C, 0, 0 ) /* ( A8 )                Digital pin 37 */ \
	_map_( D, 7, 0 ) /* ( T0 )                Digital pin 38 */ \
	_map_( G, 2, 0 ) /* ( ALE )               Digital pin 39 */ \
	_map_( G, 1, 0 ) /* ( RD )                Digital pin 40 */ \
	_map_( G, 0, 0 ) /* ( WR )                Digital pin 41 */ \
	_map_( L, 7, 0 ) /*                       Digital pin 42 */ \
	_map_( L, 6, 0 ) /*                       Digital pin 43 */ \
	_map_( L, 5, 0 ) /* ( OC5C )              Digital pin 44 (PWM) */ \
	_map_( L, 4, 0 ) /* ( OC5B )              Digital pin 45 (PWM) */ \
	_map_( L, 3, 0 ) /* ( OC5A )              Digital pin 46 (PWM) */ \
	_map_( L, 2, 0 ) /* ( T5 )                Digital pin 47 */ \
	_map_( L, 1, 0 ) /* ( ICP5 )              Digital pin 48 */ \
	_map_( L, 0, 0 ) /* ( ICP4 )              Digital pin 49 */ \
	_map_( B, 3, 0 ) /* ( MISO/PCINT3 )       Digital pin 50 (MISO) */ \
	_map_( B, 2, 0 ) /* ( MOSI/PCINT2 )       Digital pin 51 (MOSI) */ \
	_map_( B, 1, 0 ) /* ( SCK/PCINT1 )        Digital pin 52 (SCK) */ \
	_map_( B, 0, 0 ) /* ( SS/PCINT0 )         Digital pin 53 (SS) */ \
	\
	/* end */

#if (USE_MOUSE)
#define MOUSE_X_CLK_INDEX    9
#define MOUSE_X_DIR_INDEX   10
#define MOUSE_Y_CLK_INDEX   11
#define MOUSE_Y_DIR_INDEX   12
#endif

#define SHIFT_SWITCH_INDEX   15

#define PANEL_MAPPING_TABLE(_map_) \
		\
		_map_( E, 4,    MOD_LeftShift,   AC_VolumeDown     ) /* ( OC3B/INT4 )         Digital pin 2 (PWM) */ \
		_map_( E, 5,    MOD_RightShift,  AC_VolumeUp       ) /* ( OC3C/INT5 )         Digital pin 3 (PWM) */ \
		_map_( G, 5,    MOD_LeftControl, 0                 ) /* ( OC0B )              Digital pin 4 (PWM) */ \
		_map_( E, 3,    MOD_RightControl,0                 ) /* ( OC3A/AIN1 )         Digital pin 5 (PWM) */ \
		_map_( H, 3,    KEY_Esc,         KEY_F3            ) /* ( OC4A )              Digital pin 6 (PWM) */ \
		_map_( H, 4,    KEY_Enter,       0                 ) /* ( OC4B )              Digital pin 7 (PWM) */ \
		_map_( H, 5,    KEY_1,           KEY_P             ) /* ( OC4C )              Digital pin 8 (PWM) */ \
		_map_( H, 6,    KEY_5,           0                 ) /* ( OC2B )              Digital pin 9 (PWM) */ \
		_map_( B, 4,    KEY_A,           0                 ) /* ( OC2A/PCINT4 )       Digital pin 10 (PWM) */ \
		_map_( B, 5,    KEY_S,           0                 ) /* ( OC1A/PCINT5 )       Digital pin 11 (PWM) */ \
		_map_( B, 6,    KEY_D,           0                 ) /* ( OC1B/PCINT6 )       Digital pin 12 (PWM) */ \
		_map_( B, 7,    0,               0   			   ) /* ( OC0A/OC1C/PCINT7 )  Digital pin 13 (PWM) */ \
		_map_( J, 1,    KEY_2,           0			       ) /* ( TXD3/PCINT10 )      Digital pin 14 (TX3) */ \
		_map_( J, 0,    KEY_3,           0                 ) /* ( RXD3/PCINT9 )       Digital pin 15 (RX3) */ \
		_map_( H, 1,    KEY_4,           0                 ) /* ( TXD2 )              Digital pin 16 (TX2) */ \
		_map_( H, 0,    KEY_End,         0                 ) /* ( RXD2 )              Digital pin 17 (RX2) */ \
		_map_( D, 1,    KEY_7,           0				   ) /* ( SDA/INT1 )          Digital pin 20 (SDA) */ \
		_map_( D, 0,    KEY_8,           0				   ) /* ( SCL/INT0 )          Digital pin 21 (SCL) */ \
		_map_( F, 6,    KEY_9,           0				   ) /* ( ADC6 )              Analog pin 6 */ \
		_map_( F, 7,    KEY_0,           0				   ) /* ( ADC7 )              Analog pin 7 */ \
		_map_( K, 0,    J1_Button1,      0				   ) /* ( ADC8/PCINT16 )      Analog pin 8 */ \
		_map_( K, 1,    J1_Button2,      0				   ) /* ( ADC9/PCINT17 )      Analog pin 9 */ \
		_map_( K, 2,    J1_Button3,      0				   ) /* ( ADC10/PCINT18 )     Analog pin 10 */ \
		_map_( K, 3,    J1_Button4,      0				   ) /* ( ADC11/PCINT19 )     Analog pin 11 */ \
		_map_( K, 4,    J1_Button5,      0				   ) /* ( ADC12/PCINT20 )     Analog pin 12 */ \
		_map_( K, 5,    J1_Button6,      0                 ) /* ( ADC13/PCINT21 )     Analog pin 13 */ \
		_map_( K, 6,    J1_Button7,      0                 ) /* ( ADC14/PCINT22 )     Analog pin 14 */ \
		_map_( K, 7,    J1_Button8,      0                 ) /* ( ADC15/PCINT23 )     Analog pin 15 */ \
		\
		/* end */


		// (port, pin, mux, value_min, value_max, joyid, axis
		// for mega2560, mux is 0x00..0x07 => (ADC0..ADC7) and 0x10..0x17 => (ADC8..ADC15)
#define ADC_MAPPING_TABLE(_map_) \
		\   
		_map_( F, 0, 0x00, 0.000, 0.300, ID_AccelGyro, 0 ) /* Analog Pin 0 */ \
		_map_( F, 1, 0x01, 0.000, 0.300, ID_AccelGyro, 1 ) /* Analog Pin 1 */ \
		_map_( F, 2, 0x02, 0.000, 1.000, ID_AccelGyro, 2 ) /* Analog Pin 2 */ \
		_map_( F, 3, 0x03, 0.000, 1.000, ID_AccelGyro, 3 ) /* Analog Pin 3 */ \
		_map_( F, 4, 0x04, 0.000, 1.000, ID_AccelGyro, 4 ) /* Analog Pin 4 */ \
		_map_( F, 5, 0x05, 0.000, 1.000, ID_AccelGyro, 5 ) /* Analog Pin 5 */ \
		\
		/* end */

perhaps you have an idea what i´m doing wrong.

thx for help :)

Link to comment
Share on other sites

  • 0

So after my GY61 finally arrived (the first one i ordered got lost on the postway) i got some time to test but i ran into a problem.

When i use the hex codes included in your latest package all works great and my computer is showing a joystick with x,y,z and xr,yr,zr

But i need another pinmap for the ledwiz part and want to test some other values for the analog axes so i tried a self compiled hex.

The compiling went well without errors but when i flash it to my mega i will only get a joystick with an x and y axes. the other axes are missing completly. so is there a trick or something i have to do except adding the "#define ENABLE_ANALOG_INPUT" to the devconfig.h ?

here´s my devconfig.h 

/*
 * LWCloneU2
 * Copyright (C) 2013 Andreas Dittrich <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef DEVCONFIG_H__INCLUDED
#define DEVCONFIG_H__INCLUDED


/****************************************
 USB device config
****************************************/

#define ENABLE_LED_DEVICE
#define ENABLE_ANALOG_INPUT
#define USE_ACCELGYRO 1
#define ENABLE_PANEL_DEVICE
#define NUM_JOYSTICKS 0
#define USE_MOUSE 0
#define USE_CONSUMER 1
#define USE_KEYBOARD 1
 
#endif

also tested with "#define NUM_JOYSTICKS 2" but this didn´t helped

and the pinmap.h looks like this

/*
 * LWCloneU2
 * Copyright (C) 2013 Andreas Dittrich <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


#define LED_MAPPING_TABLE(_map_) \
	\
	_map_( A, 0, 0 ) /* ( AD0 )               Digital pin 22 */ \
	_map_( A, 1, 0 ) /* ( AD1 )               Digital pin 23 */ \
	_map_( A, 2, 0 ) /* ( AD2 )               Digital pin 24 */ \
	_map_( A, 3, 0 ) /* ( AD3 )               Digital pin 25 */ \
	_map_( A, 4, 0 ) /* ( AD4 )               Digital pin 26 */ \
	_map_( A, 5, 0 ) /* ( AD5 )               Digital pin 27 */ \
	_map_( A, 6, 0 ) /* ( AD6 )               Digital pin 28 */ \
	_map_( A, 7, 0 ) /* ( AD7 )               Digital pin 29 */ \
	_map_( C, 7, 0 ) /* ( A15 )               Digital pin 30 */ \
	_map_( C, 6, 0 ) /* ( A14 )               Digital pin 31 */ \
	_map_( C, 5, 0 ) /* ( A13 )               Digital pin 32 */ \
	_map_( C, 4, 0 ) /* ( A12 )               Digital pin 33 */ \
	_map_( C, 3, 0 ) /* ( A11 )               Digital pin 34 */ \
	_map_( C, 2, 0 ) /* ( A10 )               Digital pin 35 */ \
	_map_( C, 1, 0 ) /* ( A9 )                Digital pin 36 */ \
	_map_( C, 0, 0 ) /* ( A8 )                Digital pin 37 */ \
	_map_( D, 7, 0 ) /* ( T0 )                Digital pin 38 */ \
	_map_( G, 2, 0 ) /* ( ALE )               Digital pin 39 */ \
	_map_( G, 1, 0 ) /* ( RD )                Digital pin 40 */ \
	_map_( G, 0, 0 ) /* ( WR )                Digital pin 41 */ \
	_map_( L, 7, 0 ) /*                       Digital pin 42 */ \
	_map_( L, 6, 0 ) /*                       Digital pin 43 */ \
	_map_( L, 5, 0 ) /* ( OC5C )              Digital pin 44 (PWM) */ \
	_map_( L, 4, 0 ) /* ( OC5B )              Digital pin 45 (PWM) */ \
	_map_( L, 3, 0 ) /* ( OC5A )              Digital pin 46 (PWM) */ \
	_map_( L, 2, 0 ) /* ( T5 )                Digital pin 47 */ \
	_map_( L, 1, 0 ) /* ( ICP5 )              Digital pin 48 */ \
	_map_( L, 0, 0 ) /* ( ICP4 )              Digital pin 49 */ \
	_map_( B, 3, 0 ) /* ( MISO/PCINT3 )       Digital pin 50 (MISO) */ \
	_map_( B, 2, 0 ) /* ( MOSI/PCINT2 )       Digital pin 51 (MOSI) */ \
	_map_( B, 1, 0 ) /* ( SCK/PCINT1 )        Digital pin 52 (SCK) */ \
	_map_( B, 0, 0 ) /* ( SS/PCINT0 )         Digital pin 53 (SS) */ \
	\
	/* end */

#if (USE_MOUSE)
#define MOUSE_X_CLK_INDEX    9
#define MOUSE_X_DIR_INDEX   10
#define MOUSE_Y_CLK_INDEX   11
#define MOUSE_Y_DIR_INDEX   12
#endif

#define SHIFT_SWITCH_INDEX   15

#define PANEL_MAPPING_TABLE(_map_) \
		\
		_map_( E, 4,    MOD_LeftShift,   AC_VolumeDown     ) /* ( OC3B/INT4 )         Digital pin 2 (PWM) */ \
		_map_( E, 5,    MOD_RightShift,  AC_VolumeUp       ) /* ( OC3C/INT5 )         Digital pin 3 (PWM) */ \
		_map_( G, 5,    MOD_LeftControl, 0                 ) /* ( OC0B )              Digital pin 4 (PWM) */ \
		_map_( E, 3,    MOD_RightControl,0                 ) /* ( OC3A/AIN1 )         Digital pin 5 (PWM) */ \
		_map_( H, 3,    KEY_Esc,         KEY_F3            ) /* ( OC4A )              Digital pin 6 (PWM) */ \
		_map_( H, 4,    KEY_Enter,       0                 ) /* ( OC4B )              Digital pin 7 (PWM) */ \
		_map_( H, 5,    KEY_1,           KEY_P             ) /* ( OC4C )              Digital pin 8 (PWM) */ \
		_map_( H, 6,    KEY_5,           0                 ) /* ( OC2B )              Digital pin 9 (PWM) */ \
		_map_( B, 4,    KEY_A,           0                 ) /* ( OC2A/PCINT4 )       Digital pin 10 (PWM) */ \
		_map_( B, 5,    KEY_S,           0                 ) /* ( OC1A/PCINT5 )       Digital pin 11 (PWM) */ \
		_map_( B, 6,    KEY_D,           0                 ) /* ( OC1B/PCINT6 )       Digital pin 12 (PWM) */ \
		_map_( B, 7,    0,               0   			   ) /* ( OC0A/OC1C/PCINT7 )  Digital pin 13 (PWM) */ \
		_map_( J, 1,    KEY_2,           0			       ) /* ( TXD3/PCINT10 )      Digital pin 14 (TX3) */ \
		_map_( J, 0,    KEY_3,           0                 ) /* ( RXD3/PCINT9 )       Digital pin 15 (RX3) */ \
		_map_( H, 1,    KEY_4,           0                 ) /* ( TXD2 )              Digital pin 16 (TX2) */ \
		_map_( H, 0,    KEY_End,         0                 ) /* ( RXD2 )              Digital pin 17 (RX2) */ \
		_map_( D, 1,    KEY_7,           0				   ) /* ( SDA/INT1 )          Digital pin 20 (SDA) */ \
		_map_( D, 0,    KEY_8,           0				   ) /* ( SCL/INT0 )          Digital pin 21 (SCL) */ \
		_map_( F, 6,    KEY_9,           0				   ) /* ( ADC6 )              Analog pin 6 */ \
		_map_( F, 7,    KEY_0,           0				   ) /* ( ADC7 )              Analog pin 7 */ \
		_map_( K, 0,    J1_Button1,      0				   ) /* ( ADC8/PCINT16 )      Analog pin 8 */ \
		_map_( K, 1,    J1_Button2,      0				   ) /* ( ADC9/PCINT17 )      Analog pin 9 */ \
		_map_( K, 2,    J1_Button3,      0				   ) /* ( ADC10/PCINT18 )     Analog pin 10 */ \
		_map_( K, 3,    J1_Button4,      0				   ) /* ( ADC11/PCINT19 )     Analog pin 11 */ \
		_map_( K, 4,    J1_Button5,      0				   ) /* ( ADC12/PCINT20 )     Analog pin 12 */ \
		_map_( K, 5,    J1_Button6,      0                 ) /* ( ADC13/PCINT21 )     Analog pin 13 */ \
		_map_( K, 6,    J1_Button7,      0                 ) /* ( ADC14/PCINT22 )     Analog pin 14 */ \
		_map_( K, 7,    J1_Button8,      0                 ) /* ( ADC15/PCINT23 )     Analog pin 15 */ \
		\
		/* end */


		// (port, pin, mux, value_min, value_max, joyid, axis
		// for mega2560, mux is 0x00..0x07 => (ADC0..ADC7) and 0x10..0x17 => (ADC8..ADC15)
#define ADC_MAPPING_TABLE(_map_) \
		\   
		_map_( F, 0, 0x00, 0.000, 0.300, ID_AccelGyro, 0 ) /* Analog Pin 0 */ \
		_map_( F, 1, 0x01, 0.000, 0.300, ID_AccelGyro, 1 ) /* Analog Pin 1 */ \
		_map_( F, 2, 0x02, 0.000, 1.000, ID_AccelGyro, 2 ) /* Analog Pin 2 */ \
		_map_( F, 3, 0x03, 0.000, 1.000, ID_AccelGyro, 3 ) /* Analog Pin 3 */ \
		_map_( F, 4, 0x04, 0.000, 1.000, ID_AccelGyro, 4 ) /* Analog Pin 4 */ \
		_map_( F, 5, 0x05, 0.000, 1.000, ID_AccelGyro, 5 ) /* Analog Pin 5 */ \
		\
		/* end */

perhaps you have an idea what i´m doing wrong.

thx for help :)

 

 

Red Marked what you must change ! you must #define USE_ACCELGYRO 1 its another modul in the QC for the axis controller

Link to comment
Share on other sites

  • 0

big thx for the fast help now it works and i can compile my own version as the one in the package uses another ledwiz pinlayout.

in the package is a pinmap.h which would fit my needs but it seems like the hex files what are there uses the other ledwiz mapping you posted in your first post. 

now its time to get the sidewinder out of the cab and testing more :) thx again for all your work

Link to comment
Share on other sites

  • 0

please post a picture of your relais board and you pinmap.h

have you flash the mainchip via usb asp or via USB?

ist you relais board a 5v or a 12v from ebay ?

My pinmap.h I guess is standard, I have at least not changed anything. Do I need to compile anything?? I've been using the files straight out of your package, maybe that's what's wrong??

I've been using an usb-asp when I flashed the arduino.

I'm pretty new to this whole arduino thing, I've been using pic processors for my projects instead.

It's a 5v board, but I can't see how that could matter?? If it were a 12v relay-board I would just have to connect it with a separate psu and use a fet, transistor or optocoupler.

The relayswas just something I used to see if I could get a signal from the arduino, I could use a led or something.

Link to comment
Share on other sites

  • 0

make a picture of the board please on the relais stand 12v or 5v

 

 

i gives boards than need be grounded so you must compile your sourcecode by your self and make a change on it the pinmap.h in the mainfoder is only for show how i have compile the Files

 

the complete source is in the LWcloneneu2-master source folder

 

 

 

from this

#define LED_MAPPING_TABLE(_map_) \
	\
	_map_( A, 0, 0 ) /* ( AD0 )               Digital pin 22 */ \
	_map_( A, 1, 0 ) /* ( AD1 )               Digital pin 23 */ \
	_map_( A, 2, 0 ) /* ( AD2 )               Digital pin 24 */ \
	_map_( A, 3, 0 ) /* ( AD3 )               Digital pin 25 */ \
	_map_( A, 4, 0 ) /* ( AD4 )               Digital pin 26 */ \
	_map_( A, 5, 0 ) /* ( AD5 )               Digital pin 27 */ \
	_map_( A, 6, 0 ) /* ( AD6 )               Digital pin 28 */ \
	_map_( A, 7, 0 ) /* ( AD7 )               Digital pin 29 */ \

 to this

#define LED_MAPPING_TABLE(_map_) \
	\
	_map_( A, 0, 1 ) /* ( AD0 )               Digital pin 22 */ \
	_map_( A, 1, 1 ) /* ( AD1 )               Digital pin 23 */ \
	_map_( A, 2, 1 ) /* ( AD2 )               Digital pin 24 */ \
	_map_( A, 3, 1 ) /* ( AD3 )               Digital pin 25 */ \
	_map_( A, 4, 1 ) /* ( AD4 )               Digital pin 26 */ \
	_map_( A, 5, 1 ) /* ( AD5 )               Digital pin 27 */ \
	_map_( A, 6, 1 ) /* ( AD6 )               Digital pin 28 */ \
	_map_( A, 7, 1 ) /* ( AD7 )               Digital pin 29 */ \

please test this before you compile by your self

 

Connect the USP ASP to the Pinheader behind the USB port

 

Start

 

Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to Arduino.bat

 

then Disconnect the USBASP Conect USB

 

look witch comport your arduino have

 

start Flash Main Chip Arduino Mega to LW.bat

 

when Finished Disconnetc the USB and Connect the USBASP again

 

start Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to LW.bat

 

when its ready connect the USB cable and use Ledblinkys simple LED test tool to test

Link to comment
Share on other sites

  • 0

schematic.jpg

Here's a schematic of the relay-board. It's pretty basic. Connect 5v and gnd, then all you need is a 5v signal (from a mpu or other).

In other word, the arduino need to source (going high) the current, not sink it (going low).

 

sorry if I sounded harsh, it was not my intention. It's just that electronics and electricity is something I'm good at. It's just the arduino that's new to me.

 

image004.jpg

That's as far as I can go today. I'm away from home and can't try any of the stuff you suggested.

Link to comment
Share on other sites

  • 0

i dont know i must take a look on the boot loader of the 2560 chip

 

are whe LEDs ON  on the Relaisboard when you power the Arduino ?

 

i have the same in blue there is must change the pinmap.h from 0 to 1  or the Relais are everytime on 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...