Skip to Navigation | Skip to Content

UnoJoy!

Anonymous asked: Hi, I'm still making a DJ controller based on the unojoy code, I've managed to get it outputting 128 bytes, I would like to have 10 bit analogue, I've increased the axis' report size by +2, and the logical & physical max' to 1023. It's this bit I am unsure about. LEDon(TXLED); flushSerialRead(); serialWrite(0); buttonData1 = serialRead(25); how would I get a 2 byte serialWrite and serial read? I've looked at the Megajoy but am still unsure.

Hi! Sorry I took so long to get back to this - I’ve been slammed with work for the past week, and apparently you’ve already figured it out. I’d love to hear more about what you’re making, though! Sounds super rad.

seajayshore asked: Sorry to ask again if you are busy but it's really slowing me down a bit now. Is there anyway to install UnoJoy! on OS X Mavericks or is it not supported? I found something on your google code site called "vasco-maverick-compile" but I'm not sure if this is what I need... Please help, it would be much appreciated. Or tell me if it is not possible at all. Thanks.

I just uploaded some code for Mountain Lion yesterday and moved the codebase to GitHub, but I haven’t updated the links yet..

I haven’t gotten around to installing Mavericks on my macbook yet, since I was waiting to get some time to try the Mountain Lion code/install process, but give it a shot… I’m guessing the issue you might have will be with getting LibUSB to install (that’s actually what the MountainLionDriver.pkg installs)?

https://github.com/AlanChatham/UnoJoy/releases

If the libusb driver won’t install, try getting the binary from here: http://www.ellert.se/twain-sane/

And please let me know if it works or not, so I can update things for Mavericks! Thanks so much!

Anonymous asked: Could you please include a simple demo sketch for automatic output? I have written a firmware with 128 buttons and 48 axis'/sliders and would like to prove it before, starting a project build blog and spending a small fortune on buttons, many thanks nick.

Hi Nick! I suppose it’ll take a tiny bit of adjusting to adapt for MegaJoy!, but in the UnoJoy! examples, you might look at KnifeController - it’s a controller we made for Assassin’s Creed using a fake knife, and there’s one button which, when pressed, activates several buttons at once.

https://code.google.com/p/unojoy/source/browse/Examples/KnifeController/KnifeController.ino

http://www.youtube.com/watch?v=tM6l3KQ-Uo8

Otherwise, some basic test code to toggle your buttons and move your joysticks in your loop would look something like:

void loop(void){

  for (int i = 0; i < 8; i++){

    controllerData.buttonArray[i] = 0b11111111; // Turn all buttons on

  }

  for (int i = 0; i < 12; i ++){

    controllerData.analogAxisArray[0] = 10;

  }  

  delay(500);

  for (int i = 0; i < 8; i++){

    controllerData.buttonArray[i] = 0b00000000; // Turn all buttons off

  }

  for (int i = 0; i < 12; i ++){

    controllerData.analogAxisArray[0] = 245;

  }

  delay(500);

}

I don’t have a Mega on me right now, so let me know if that code doesn’t work…

colinwirral asked: Hi Guys, I’ve been working on a Plug and Play Sega Outrun Arcade Machine interface wing PCB with an UNO to support a project called Cannonball using a custom serial packet interface to allow full motion control etc, but this opens up a lot of other options to allow the Arcade Cab to play other games….(but without the motion aspect - that could be simulated by looking at the wheel movements anyway) I’ll let you know how I get on…. Amazing idea using the UNO as a HID…. Thanks for doing this :-)

Anonymous asked: Hi! I would like to use UnoJoy with an optical encoder(simple incremental) because I build a homemade wheel. How can I modify the code to make it work? Thank you very much for your answer.

You probably just want to update the ArduinoSample project that comes with UnoJoy! to store a number as a global value that tracks the position of your wheel from 0 to 255, then set the left joystick position to that value during the controller update function.

yethal asked: is it possible to replicate full PS3 layout on Arduino Uno (4 face buttons, dpad, start, select, PS Button, R1 L1 R2 L2 R3 L3 and both joysticks) or will I have to use Arduino Mega? if it is possible with Uno how to wire the buttons since I have more buttons than available input pins, and if it requires a Mega, how to flash it so it will show up as one PS3 controller?

It’s totally possible to pack all the buttons onto a single Arduino, but you’ll need to do a bit of input multiplexing - it’s not that complicated, but there’s some extra wiring involved - for a good tutorial, check out this

http://www.dan-nixon.com/2012/04/multiplexing-switches-on-arduino.html

If you don’t want to mess around with this, or if you plan on hitting a lot of buttons at the same time (that form of multiplexing can lead to ambiguous button input signals if you’re pressing a ton of buttons), you can flash UnoJoy! onto an Arduino Mega as well.

yethal asked: Hi, I'm fairly new to microcontrollers so please forgive my ignorance. I want to build full PS3 controller with Your library. To the actual question, do I need to use two joystick shields or can I just stuff all the tact switches on a breadboard?

You should be able to hook up tact switches on a breadboard and have no issues!

Anonymous asked: Hi! If I were to put megajoy on a mega, would it be possible to use two way serial communication with the computer at the same time? Essentially I am trying to retain the ability for the arduino to interpret commands from the computer while being used as USB HID.

Hmm… The easiest way to do what you’d like would be to get an Arduino Leonardo-compatible board and use LeoJoy! - that shows up to the computer as a joystick and a serial port, so you can have all the communication there. Since UnoJoy!/MegaJoy! uses the hardware serial port on the main chip to send controller state info to the communication chip, it’s not really possible to use the serial port for something else.

One other way would be to use one of the other hardware serial ports on the mega (or run the software serail library on an Uno), and then hook up another Arduino or other USB/Serial bridge to those other pins, and use that for serial communication alongside running MegaJoy! on the main chip.

Anonymous asked: Further to thisHi is it possible to change the button output from 1 byte to 1 bit? The unojoy does output 8 bits of data for a single button press, changing usb gamepad c (somewhere near line 353) triangle axis = 0xFF; and swap out 0xFF to 0x01 and then you have 1 bit output. Also tumblr is awful for submitting code.

Ah! I forgot about that part of the code!  So, those ‘whateverButton_axis’ fields are part of the extended, ‘Unknown’ section of the USB report descriptor, and they set the analog button pressure values for the PS3 controller USB output. See, each button on the PS3 controller is actually an analog button, so it sends out both a 1 bit button signal, then later sends a 8 bit ‘intensity’ signal. Certain games rely on the analog button values instead of the digital ones - for instance gas and brake in Gran Turismo - so UnoJoy! sets those values to 255 when the button is pressed, and 0 when unpressed, since otherwise UnoJoy! doesn’t deal with analog button inputs.

So, if you’re not using UnoJoy! in conjunction with the PS3, and you’re concerned for some reason that it’s sending too large of USB packets, you could probably go into the gamepad.c and gamepad.h files and cut out all the button axis code, and modify the HID report descriptor to remove all the ‘unknown’ HID report code stuff.

Page 1 of 14

Previously