Author Topic: Wii Nunchuck Example "DigisparkJoystickDemo" - works really well!  (Read 7165 times)

bb

  • Newbie
  • *
  • Posts: 9
Hi.


I thought I'd fancy some hardware with an analog stick to control my space-crafts in Kerbal Space Program, but I did not want to spend money on something that might prove to be useless.


Behold! the Nunchuck-Shield! Currently sold out but I do not even get so far.


Loading up the example on the 19-May version of the IDE, I told it to verify the code and it comes back with errors incomprehensible to me :(
Code: [Select]
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=104 -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\cores\arduino -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\variants\standard -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkNunchuk -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\TinyWireM_Digispark C:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystickDemo.cpp -o C:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystickDemo.cpp.o
In file included from C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:18,
                 from DigisparkJoystickDemo.ino:3:
c:/users/user/my apps/digisparkarduino-win32_may_19/digispark-arduino-1.0.4/hardware/tools/avr/lib/gcc/../../avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>."
In file included from DigisparkJoystickDemo.ino:3:
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:56: warning: only initialized variables can be placed into program memory area
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:94: warning: only initialized variables can be placed into program memory area
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h: In member function 'void DigiJoystickDevice::update()':
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:164: warning: comparison between signed and unsigned integer expressions
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\tools\avr\bin\avr-gcc -c -g -assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=104 -DUSB_VID=null -DUSB_PID=null -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\cores\arduino -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\variants\standard -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkNunchuk -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\TinyWireM_Digispark -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\utility C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\usbdrvasm.S -oC:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystick\usbdrvasm.S.o
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc: Assembler messages:
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:45: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:61: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:98: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:99: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/usbdrvasm16.inc:333: Error: constant value required

I have looked at the code but it does not speak to me (noob).

Would you be able to figure out what is wrong with it?
Is it just my box or is the example not working in the first place?


Cheers!
chris :)
-edit: improved cosmetics by removing some strange markups that crept in
« Last Edit: June 30, 2013, 06:57:29 am by bb »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #1 on: June 25, 2013, 10:45:30 am »
Looks like you need to select the Digispark from Tools->Boards and Tools->Programmer.


We're making some slight revisions to the Nunchuck shield and then we'll have it back in stock.

bats

  • Newbie
  • *
  • Posts: 5
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #2 on: June 25, 2013, 11:28:04 am »
I thought I'd fancy some hardware with an analog stick to control my space-crafts in Kerbal Space Program, but I did not want to spend money on something that might prove to be useless.

I really hope KSP isn't half as entertaining as it looks... otherwise you may have just back-burnered everything I was working on.


Loading up the example on the 19-May version of the IDE, I told it to verify the code and it comes back with errors incomprehensible to me :(
Code: [Select]
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=104 -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\cores\arduino -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\variants\standard -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkNunchuk -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\TinyWireM_Digispark C:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystickDemo.cpp -o C:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystickDemo.cpp.o
In file included from C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:18,
                 from DigisparkJoystickDemo.ino:3:
c:/users/user/my apps/digisparkarduino-win32_may_19/digispark-arduino-1.0.4/hardware/tools/avr/lib/gcc/../../avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>."
In file included from DigisparkJoystickDemo.ino:3:
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:56: warning: only initialized variables can be placed into program memory area
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:94: warning: only initialized variables can be placed into program memory area
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h: In member function 'void DigiJoystickDevice::update()':
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick/DigiJoystick.h:164: warning: comparison between signed and unsigned integer expressions
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\tools\avr\bin\avr-gcc -c -g -assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=104 -DUSB_VID=null -DUSB_PID=null -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\cores\arduino -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\hardware\arduino\variants\standard -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkNunchuk -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\TinyWireM_Digispark -IC:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\utility C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\usbdrvasm.S -oC:\Users\user\AppData\Local\Temp\build2916326588377477480.tmp\DigisparkJoystick\usbdrvasm.S.o
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc: Assembler messages:
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:45: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:61: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:98: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/asmcommon.inc:99: Error: constant value required
C:\Users\user\My Apps\DigisparkArduino-Win32_may_19\Digispark-Arduino-1.0.4\libraries\DigisparkJoystick\/usbdrvasm16.inc:333: Error: constant value required
I have no nunchucks (ie, don't scramble to fix anything on my account), but I needed a break from pounding my head repeatedly against this nice wall here & gave it a try anyhow... DigisparkJoystickDemo - which it looks like you're using - compiles fine for me (using 1.0.4 on OSX 10.6.8, board set to Digispark (Tiny Core)), but ArduinoNunchuckDemo (in the same folder) - gave me a different assortment of complaints...

Code: [Select]
/Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=attiny85 -DF_CPU=16500000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=104 -I/Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny -I/Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/libraries/Arduino_Wire -I/Users/Bats/Documents/Arduino/libraries/DigisparkNunchuk /var/folders/uw/uwLBKHh9EG8Cn6Ny3qLj9U+++TI/-Tmp-/build5767745202039994390.tmp/ArduinoNunchukDemo.cpp -o /var/folders/uw/uwLBKHh9EG8Cn6Ny3qLj9U+++TI/-Tmp-/build5767745202039994390.tmp/ArduinoNunchukDemo.cpp.o
In file included from /Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny/Stream.h:24,
                 from /Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/libraries/Arduino_Wire/Wire.h:26,
                 from ArduinoNunchukDemo.ino:10:
/Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny/Print.h:37:1: warning: "BIN" redefined
In file included from /Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/avr/iotn85.h:38,
                 from /Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/avr/io.h:284,
                 from /Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/avr/pgmspace.h:82,
                 from /Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny/Print.h:30,
                 from /Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny/Stream.h:24,
                 from /Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/libraries/Arduino_Wire/Wire.h:26,
                 from ArduinoNunchukDemo.ino:10:
/Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/avr/iotnx5.h:55:1: warning: this is the location of the previous definition
In file included from ArduinoNunchukDemo.ino:10:
/Developer/Applications/DigisparkArduino.app/Contents/Resources/Java/libraries/Arduino_Wire/Wire.h:61: error: conflicting return type specified for 'virtual size_t TwoWire::write(const uint8_t*, size_t)'
/Users/Bats/Documents/Arduino/hardware/digispark/cores/tiny/Print.h:75: error:   overriding 'virtual void Print::write(const uint8_t*, size_t)'


-edit: improved cosmetics by removing some strange markups that crept in
This forum seems to like inserting odd markup... I gave up on the WYSIWYG view altogether, and it still seems to try switching font sizes at random. I thought it was just trying to tell me that I was talking too much & should shut up and hit 'send'.


-Bats

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #3 on: June 25, 2013, 08:23:28 pm »
ArduinoNunchuckDemo is for the Arduino Uno DigisparkJoystickDemo and DigisparkUSBDemo are for the Digispark - the Arduino demo is included to comply with the license of the library and give credit where it is due - sorry if that isn't clear.

bb

  • Newbie
  • *
  • Posts: 9
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #4 on: June 26, 2013, 01:01:11 am »
Hardware: no worries about the shield. i sawed some old hardware into pieces and already got the connector for the nunchuck. not much else is going on on the shield, so that is not a problem.


software: license... so that is why there is more. interesting.


however: all examples *should* just compile, regardless of target-platform and available hardware, right?


workaround: i got a buddy with a macbook. maybe i can koax him into compiling the stuff for me. if there is anything more to do than press "GO" i am screwed anyway and it's "next stop, Amazon, controllers-department"  ;D


OH! i just see i have been missing that little line there: "wrong settings". ya. that may well be. i upgraded the IDE to get the Nunchuck-example in the first place. that could have reset the thing. let me try that once i am at home.

bb

  • Newbie
  • *
  • Posts: 9
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #5 on: June 26, 2013, 02:41:17 am »
yes .compliles now. Thank you!


but the digispark does not get recognized for programming. I'll browse the forums a bit for that.

bb

  • Newbie
  • *
  • Posts: 9
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #6 on: June 26, 2013, 04:55:16 am »
layer 8 problem.


honestly, i have been playing with this at work. not at home.
and i got a new computer a few months back.
and the last time i played with the digispark was on the old box.
and this new one had not even the drivers installed.


coming to that conclusion i followed the installation instructions and who would'a thought: if you're doing it right, it works:
compiled okay, flashed okay, shows up as USB game controller, properties of that look like they could represent a wii nunchuck.


next stop: soldering!


i plan to keep you posted.
Thank you

bb

  • Newbie
  • *
  • Posts: 9
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - Did that ever work?
« Reply #7 on: June 30, 2013, 06:57:01 am »
Quote
DER GEEEEHT!!
an insider from a German prank-call to a tech-shop about a "broken VCR" enthusiastically shouting IT WOOOORKS!


which it does.


after 10 years of wondering what a "pull-up" resistor is I read up on them (something for when things are disconnected) and found that I might be able to live without them by defining that nothing is to be left disconnected under power. The true Kerbal way!


and voila. A bit of soldering and I got my adapter working pretty much on the first attempt (the hardware - not the software as you can read above)
Thank you!
--
contents:
* an itsy bitsy piece of PCB cut from a CPU-voltage regulator-board from a compaq server filed to fit
* pieces of wire from LED-leads from a 1998 (?) PC-tower-case - i knew that I'd needed them some time!
* male pin-connectors for the digispark to reduce mess with the wire-attaching


digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Wii Nunchuck Example "DigisparkJoystickDemo" - works really well!
« Reply #8 on: July 01, 2013, 10:57:32 am »
Great news! Thanks for sharing your success!