Max For Live Not Patch Not Updating Data on Arduino Display - c++

I've been working on a project with an Arduino recently where I'm basically trying to get a small display hooked up to an Arduino to update with the name of a MIDI mapped knob in Ableton Live.
For example, let's say I map the knob to the reverb send on a track the display should read "A-Reverb". This works today, but only works when I first open the Ableton project and map the knob for the first time. It does not update when I select a new option.
Here's the setup I'm using right now:
Arduino - w/Rotary Encoder & OLED Display
Hairless MIDI - For converting the serial connection from the Arduino into MIDI CC# messages Live can read.
Ableton Live 11 w/ Max For Live 8 - This is where the patch actually runs.
For the Max Patch, I'm using a version of Yehezkel Raz's One which I purchased and later modified. The reason I mention this is that this patch already has the name updating part worked out, so in theory I should be able to send that data over serial to the Arduino.
Out of respect for Yehezkel's work, I won't attach a screenshot of the entire patch, but have attached the part that I modified to send data to the Arduino, you can see it here.
Here's what I've tried so far:
Validated that the baud rate for Hairless MIDI, the Arduino, and the Max Patch is identical
Attempted to start Hairless MIDI only after Ableton has been launched
Attempted to power on Arduino without opening the Arduino IDE so that there are no Serial conflicts.
Here's what I think may be the issue, but I'm not sure how to fix it:
Part of the logic in my Arduino code relies on Serial.available() being true, in order to send the data to the screen. I'm thinking that maybe the Serial connection is only available in the beginning when the knob is mapped.
I know that was a lot of information, but if anyone has any ideas on how I may be able to get this to work, I'd greatly appreciate it!

Okay I figured this out on my own; basically what was happening was my code was expecting a line feed in order to refresh the output on the display. I figured out that I could send a line feed over the serial connection by sending the value "10" which would basically terminate the string as it is sent to the Arduino.
Any time the knob value is updated, it triggers a button which sends the value "10" back to the Arduino.
I've attached a screenshot showing the changes I made in case this helps anyone else out:

Related

Capture mouse HID packets on windows using C++?

I want to ditch Razer Synapse because it eats up to 600MB of RAM for nothing. I just want to use my macros for two additional keys found on my Razer Deathadder. I've sucessfully captured the HID packets for my Corsair K95 keyboard with C++ HID API and executed my macros, finally was able to say bye bye to iCUE. But I'm not able to open mouse as HID device. Everything should be configured properly, VID/PID, UsagePage and Usage too. But the interesting thing is that wireshark is able to capture the mouse, for me it doesn't for even when I try to open it with admin priveliges. Does somebody have any idea what I should do?
I've tried hidapitester application which is part of HIDAPI C++ library, it automatically closes the device and doesn't receive anything. If it's not possible to solve it in this way, which approach I should use to be able to capture the packets?
Thank you.

Arduino GSMShield

I've been working on a project with arduino UNO and GSM Shield.
I'm uploading to Internet data every 30 minutes from a maxbotix sensor. Code hangs and loops continuously with the serial monitor showing gsm.begin() waiting for reply.
I have read very carefully all the related forums and rewrote the library file GSM3ShieldV1AccessProvider.cpp as per http://forum.arduino.cc/index.php?topic=233137.0
Unfortunatelly this doesn't solve the problem. With gsm debug set to true it stucks on the the infamous AT%13% (post http://forum.arduino.cc/index.php?topic=233137.0)
This is driving me mad as it ruins the whole project.
Anyone has find a workaround?
If Arduino stucks at this point that's because the modem is answering with ERROR to the AT command and it doesnt continue to AT+CPIN, AT+CGREG ...
So, obviously it's not a SIMcard problem neither a APN problem
Have you try to update the GSM library?
Please, show me the debug log you are getting
GSM gsmAccess(1);

Issue with hex data being sent out of a serial port

I am really hoping someone can help me with this issue, I have been working on it for 3 days and its driving me insane now.
I have two linux based devices connected over serial, one is an embedded device the other is a pc type device. I have some python code on the PC device that currently, successfully reads messages sent by the embedded device (hence the serial settings are correct).
However I now need to send commands back to the embedded device and this is what i am struggling with, I have a data tap on the serial line so i can see the data being sent / received.
When I send the string "\x2a\x00\x00\x00\x00\x00\x57\x78\xD6\x81\x00\x01\x00\x8D\x54" out of the serial port, on the serial data tap I see only "EF F7 FF FF".
Please see the code below:
import serial
serialport = serial.Serial(port=self.device,
baudrate=self.baudrate,
bytesize=self.bytesize,
parity=self.parity,
stopbits=self.stopbits,
timeout=0)
data = "\x2a\x00\x00\x00\x00\x00\x57\x78\xD6\x81\x00\x01\x00\x8D\x54"
serialport.write(data)
serialport.flushOutput()
This is now resolved, turned out to be a couple of issues the customer neglected to tell me that unless the embedded device is in engineering mode it will ignore commands. Also the data tap had a dip switch set incorrectly, so there was nothing wrong with my code. Thanks to Shane for making me question the hardware and not my code !

Using uTOLED-20 with RaspBerryPI

Recently I bought an uTOLED-G20 with the 4D Serial Adaptor. My current hardware connection is the following one (enclosed picture)
My goal is to show the camera in the uTOLED screen. But before to achieve this I would like to send "some picture (.gif, .bmp, .jpg) to the display", or some "Hello world".
Well this task is going me crazy. I was reading http://elinux.org/Serial_port_programming and nothing appears in the uToled.
I want able to develop some software in python or C, c++ in my Linux (RaspberryPI) and show the data in the screen.
Please could you help me from where I can start?
I will really appreciate all your feedback. :-)
The first thing I would do is connect the RX and TX on the RPi together to make sure you are sending and receiving characters on the RPi.
In follow up to the loopback test, you can do this with a few tricks from the command line. Essentially you can #echo "foo" > /dev/ttyAMA0 from one console, and #tail -f from another console. For more specific directions check out this older post: Serial port loopback/duplex test, in Bash or C? (process substitution)

How to split audio or write demuxer filter in directshow?

I need to split a PCM audio stream with up to 16 channels into several stereo streams.
As I haven't found anything capable of doing that, I'm trying to write my first directshow filter.
Anything capable of splitting the audio would be very welcomed but I'm assuming that I must do it so there's what I've done:
At first, I tried to create a filter based on ITransformFilter. However, it seems that it's made thinking of filters with only one input pin and one output pin. As I need several output pins, I disregarded it, however perhaps it can be adapted more easily than I thought, so any advice is highly appreciated.
Then, I begin basing on IBaseFilter. I managed to do something. I create the necessary output pins when the input pin gets connected, and destroy them when the input gets disconnected. However, when I connect any output pin to an ACM Wrapper (just to test it), the input tries to reconnect, destroying all my output pins.
I tried to just not destroy them, but then I checked the media type of my input pin and it had changed to a stereo stream. I'm not calling QueryAccept from my code.
How could I avoid the reconnection, or what's the right way to do a demuxer filter?
Edit 2010-07-09:
I've come back to ITransformFilter, but I'm creating the necessary pins. However I've encountered the same problem as with IBaseFilter: When I connect my output pin to an ACM Wrapper, the input pins changes its mediatype to 2 channels.
Not sure how to proceed now...
You can take a look at the DMOSample in the Windows Server 2003 R2 Platform SDK. It is also included in older directx sdk's, but not in newer windows sdk's. You can locate it in Samples\Multimedia\DirectShow\DMO\DMOSample. Here is the documentation of this sample.
I have seen someone create a filter based on this which had a stereo input and two mono outputs. Unfortunately I cannot post the sourcecode.