home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Looking for help writing a plug in for arduino interface
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="hurley" data-source="post: 1174843" data-attributes="member: 151395"><p>Those HID keyboard/mouse Arduino's should be plug'n'play just like similar remotes as far as controlling MP goes.</p><p>It sounds like you're most of the way there if you've got your Arduino controlling external stuff via relays and the like with remote input.</p><p></p><p>Now you want a nice GUI within MediaPortal with some buttons to control stuff via your Arduino ... ?</p><p></p><p><span style="font-size: 12px"><strong>Part 1</strong></span></p><p><span style="font-size: 12px"><strong>1.</strong></span> You need to create some command codes that map to functions which your Arduino can control.</p><p><span style="font-size: 12px"><strong>2.</strong></span> Set up your Arduino to monitor the serial port for these commands in the main loop.</p><p><span style="font-size: 12px"><strong>3.</strong></span> When a recognised command is received -> Arduino performs the action.</p><p></p><p><span style="font-size: 12px"><strong>Part 2</strong></span></p><p>You want a MP GUI or 'Window' plugin for this. Start with a basic one with a couple of buttons to get you started.</p><p>These pages should have everything you need to get this up and running:</p><p></p><p><a href="http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins" target="_blank">MediaPortal Wiki > MediaPortal 1 > Contribute > Plugins</a></p><p><a href="http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Developer%27s_Guide/1_Develop_a_Plugin" target="_blank">MediaPortal Wiki > MediaPortal 1 > Contribute > Plugins > Plugin Developer's Guide > Develop a Plugin</a></p><p></p><p>Once that's up and running you'll need to instantiate a serial port object, set the port that your Arduino is connected to and open the serial port.</p><p>ref: <a href="https://msdn.microsoft.com/en-us/library/system.io.ports.serialport%28v=vs.110%29.aspx" target="_blank">System.IO.Ports.SeriaPort</a></p><p>[code]System.IO.Ports.SerialPort sp1 = new System.IO.Ports.SerialPort("COM1");</p><p>sp1.Open();[/code]</p><p></p><p></p><p>When you get to this part: <em>Performing an action when a MP button is pressed</em>. Use your Serial Port object to send your command to the Arduino.</p><p>[code]protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)</p><p>{</p><p> if (control == buttonOne)</p><p> OnButtonOne();</p><p> if (control == buttonTwo)</p><p> OnButtonTwo();</p><p> base.OnClicked (controlId, control, actionType);</p><p>}</p><p> </p><p>private void OnButtonOne()</p><p>{</p><p> sp1.Write("your special command code");</p><p>}</p><p> </p><p>private void OnButtonTwo()</p><p>{</p><p> //...</p><p>}[/code]</p><p></p><p></p><p>Take a look at MediaPortal's built in Window Plugins for an example of how write your own:</p><p><a href="https://github.com/MediaPortal/MediaPortal-1/tree/master/mediaportal/WindowPlugins" target="_blank">https://github.com/MediaPortal/MediaPortal-1/tree/master/mediaportal/WindowPlugins</a></p><p>And google for user friendly guides on using the serial port.</p><p></p><p>Hope that help's get you started and doesn't scare you off.</p><p>Good luck with your project, it sounds like a great idea! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="hurley, post: 1174843, member: 151395"] Those HID keyboard/mouse Arduino's should be plug'n'play just like similar remotes as far as controlling MP goes. It sounds like you're most of the way there if you've got your Arduino controlling external stuff via relays and the like with remote input. Now you want a nice GUI within MediaPortal with some buttons to control stuff via your Arduino ... ? [SIZE=3][B]Part 1[/B] [B]1.[/B][/SIZE] You need to create some command codes that map to functions which your Arduino can control. [SIZE=3][B]2.[/B][/SIZE] Set up your Arduino to monitor the serial port for these commands in the main loop. [SIZE=3][B]3.[/B][/SIZE] When a recognised command is received -> Arduino performs the action. [SIZE=3][B]Part 2[/B][/SIZE] You want a MP GUI or 'Window' plugin for this. Start with a basic one with a couple of buttons to get you started. These pages should have everything you need to get this up and running: [URL='http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins']MediaPortal Wiki > MediaPortal 1 > Contribute > Plugins[/URL] [URL='http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Developer%27s_Guide/1_Develop_a_Plugin']MediaPortal Wiki > MediaPortal 1 > Contribute > Plugins > Plugin Developer's Guide > Develop a Plugin[/URL] Once that's up and running you'll need to instantiate a serial port object, set the port that your Arduino is connected to and open the serial port. ref: [URL='https://msdn.microsoft.com/en-us/library/system.io.ports.serialport%28v=vs.110%29.aspx']System.IO.Ports.SeriaPort[/URL] [code]System.IO.Ports.SerialPort sp1 = new System.IO.Ports.SerialPort("COM1"); sp1.Open();[/code] When you get to this part: [I]Performing an action when a MP button is pressed[/I]. Use your Serial Port object to send your command to the Arduino. [code]protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { if (control == buttonOne) OnButtonOne(); if (control == buttonTwo) OnButtonTwo(); base.OnClicked (controlId, control, actionType); } private void OnButtonOne() { sp1.Write("your special command code"); } private void OnButtonTwo() { //... }[/code] Take a look at MediaPortal's built in Window Plugins for an example of how write your own: [URL]https://github.com/MediaPortal/MediaPortal-1/tree/master/mediaportal/WindowPlugins[/URL] And google for user friendly guides on using the serial port. Hope that help's get you started and doesn't scare you off. Good luck with your project, it sounds like a great idea! :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Looking for help writing a plug in for arduino interface
Contact us
RSS
Top
Bottom