Spotify info over USB, VB help?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Spotify info over USB, VB help?

Post by hyperion007 »

Ok, so I am working on many small parts of a bigger project.

I got a PIC18F4550 working with the USB Slave example "No Service Slave" and the ECIO_Interface_Example.vbproj

I can send bytes and get a reply

But, I do not understad VB.net

Here is what I want to accomplish:

I have a VB "class" that is a Spotify API.

This is what that looks like:
Dim Spotify As New Spotify()

Spotify.PlayPause()
Spotify.PlayPrev()
Spotify.PlayNext()
Spotify.Mute()
Spotify.VolumeUp()
Spotify.VolumeDown()
Spotify.Nowplaying() (Gets the name of the current playing track)
Spotify.Search("Artist",False) (Searches for "Artist")
Spotify.Search("Artist",True) (Searches for "Artist" and starts playing the results)


Now, I want to run a small program, written in VB, on my computer, that sends Spotify.Nowplaying() to my PIC over USB as a string that can be displayed on my LCD.
This should happen as soon as there is a change in Spotify.Nowplaying() so as soon as the track is changed in Spotify.

Also I want the VB program to scan for changes on three variables on the PIC so that if I push a switch connected to the PIC, that alters variable_1 that toggles the Spotify.PlayPause()
and variable_2 is Spotify.PlayPrev()
and variable_3 is Spotify.PlayNext()


I have managed to get this example running:
Public Class Form1
Dim spotify As New spotify

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = spotify.Nowplaying
End Sub
End Class

but that is just a local application with a button that when clicked prints Spotify.Nowplaying() as text in the program window.


How to combine this I have no idea, but maybe someone here does?

Here is the link to Spotify.vb http://spotifyomatic.codeplex.com/
Last edited by hyperion007 on Mon Feb 11, 2013 12:12 pm, edited 1 time in total.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: Spotify info over USB, VB help?

Post by hyperion007 »

This can now be moved to the V5 forum (I have registered for the V5 portion of the forum)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: Spotify info over USB, VB help?

Post by hyperion007 »

Is there anyone here that knows VB that could help me out?

The best would be a windows service but a small application that could be minimized to tray would also be ok, or even a "regular" application, beggers can't be choosers :)

How would one go about storing the (artist - title) as a variable? Isn't there a limit on the length of a string?

/Daniel

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Spotify info over USB, VB help?

Post by Benj »

Hello Daniel,

You should be able to do some VB tutorials to get you up to speed with using the software. Trying to run before you can walk is a common issue. It's quite straightforward once you get the hang of the basics but I find that I constantly have to use Google to find out how to do specific bits and pieces or to solve issues.

Regarding the length of a string, depends what your using, a 8-bit PIC for example has a array/string size limit of 256 bytes. The PC, AVR, ARM etc will all be fine with larger arrays/strings as long as there is enough free RAM to support the variable.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: Spotify info over USB, VB help?

Post by hyperion007 »

Trying to run before walking is what I always do :)

I thought this could be a fun project that shouldn't be too hard to pull off and would give me an insight on how the VB sample program works and can be rewritten. I find it much easier to learn when I have two applications that use the same resourses to do different things, being able to compare the two.

I just ordered a book on VB programming but I am a bit impatient. I'll keep this post updated but if anyone wants to chip in that would be great.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Spotify info over USB, VB help?

Post by Benj »


Post Reply