Notifications
Clear all

MyoWare EMG sensor computer mouse clicking

57 Posts
4 Users
9 Likes
3,582 Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @gusmill33

@will the MPU6050 Library by electronic cats.

OK, thanks.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will Yup!


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7074
 

@gusmill33 I like the Adafruit library more.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7074
 

@will Simple enough to delete them after, but to each his own.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @zander

@will Simple enough to delete them after, but to each his own.

The problem is identifying which ones were added. I don't want to zip the library beforehand so that I can restore it to its original state afterwards.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will Just the MPU6050 library was used.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @gusmill33

@will Just the MPU6050 library was used.

Well, I'm having problems because the IDE is telling me that Mouse is undefined. It seems that I'm missing the mouse code even after downloading it again from the repository.

I'm kind of stuck here now.

Edit - I've discovered that Mouse isn't available on all boards ... 

Edit 2 - switched to Leonardo and can now compile (whew !)

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will Oh. I also believe I am using the USBHost library. Here https://github.com/arduino-libraries/USBHost  . I am sorry I forgot to mention this earlier.

 

Edit - Alright if it is compiling then that works.

This post was modified 2 years ago by GusMill33

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7074
 

@will I just did a clean compile on an UNO

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@gusmill33 

Here is a new sketch (called sketch0) for you to test. It reads the Myoware on analogue pin A0 and sends the appropriate mouse button messages.

Each time through the loop it reads the Myoware sensor and when that reading is from 300-500 it sends a mouse press left message to the PC; when the value os from 600-1000 it sends a mouse press right message to the PC; otherwise (i.e. not in a critical zone) it tests to see if the left or right button is pressed and, if so, releases it.

Hope this helps.

As an aside, you should be making lots of comments in your code. You know what you're doing now, but when you come back in a year to look at you'll wonder what was going on. As an example, check the comments in the module checkMouseButton.

It also helps you and anybody else who looks at your code to use meaningful names for modules and variables. If you see the module "fire()" you don't know whether to duck or get an extinguisher 🙂

 

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @zander

@will I just did a clean compile on an UNO

So nice, so nice, we do it twice 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will Awesome! Thank you so much! I will test to see if everything works and check back here.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will So as it seems right now the code is clicking at all times. 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 
Posted by: @gusmill33

@will So as it seems right now the code is clicking at all times. 

You'll remember that you said you wanted it to re-issue the mouse command each time through the loop.

If you only want it to click when entering for the first time, delete the 4 lines indicated in the sketch nd test again.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gusmill33)
Member
Joined: 2 years ago
Posts: 20
Topic starter  

@will Even after doing this there is the same issue.


   
ReplyQuote
Page 3 / 4