OK, I'll be off for a while but I'll check it out later. If you've made any significant changes, please post 'em so we're both working from the same base. If all you did was delete the 4 lines, then we're good to go.
Anything seems possible when you don't know what you're talking about.
Here's another one to test. Dinner time !
Anything seems possible when you don't know what you're talking about.
OK, I'll be off for a while but I'll check it out later. If you've made any significant changes, please post 'em so we're both working from the same base. If all you did was delete the 4 lines, then we're good to go.
Ok I will work with this and see what happens. If I make any huge changes I'll be sure to post them. Thank you for all the help!
I am not sure if this would be helpful but years ago I made an assistive device that used five myo inputs to emulate a keyboard and mouse. It worked but required too much coordination so I am now, nine years later, looking at using only two inputs. Below is to portion of my code for the mouse control and I hope that it will help. Unfortunately I do have a memory condition that makes it very difficult to relearn so be patient if you have any questions. I am still trying to figure out how I wrote this code!
This is my first time posting a code so please be gentle.
Paul
int previousA0 = 0 ; int previousA1 = 0; int previousA2 = 0 ; int previousA3 = 0; int anyChange = 0; int changeA0 = 0; int changeA1 = 0; int changeA2 = 0; int changeA3 = 0; elapsedMillis sinceChange = 0; elapsedMillis mouseChange = 0; int movingLeft = 0; int movingRight = 0; int movingUp = 0; int movingDown = 0; void setup() { Mouse.begin(); } int nowA0, nowA1, nowA2, nowA3; void loop() { // input 1 nowA0 = analogRead(A0); if (nowA0 > 250 && previousA0 <= 250) { changeA0 = 1; if (anyChange == 0) { anyChange = 1; sinceChange = 0; } } previousA0 = nowA0; // input 2 nowA1 = analogRead(A1); if (nowA1 > 250 && previousA1 <= 250) { changeA1 = 1; if (anyChange == 0) { anyChange = 1; sinceChange = 0; } } previousA1 = nowA1; // input 2 nowA2 = analogRead(A2); if (nowA2 > 250 && previousA2 <= 250) { changeA2 = 1; if (anyChange == 0) { anyChange = 1; sinceChange = 0; } } previousA2 = nowA2; // input 4 nowA3 = analogRead(A3); if (nowA3 > 250 && previousA3 <= 250) { changeA3 = 1; if (anyChange == 0) { anyChange = 1; sinceChange = 0; } } previousA3 = nowA3; if (anyChange == 1) { if (sinceChange > 50) { { if (changeA0 == 1 && changeA1 == 1) Mouse.click(MOUSE_LEFT); else if (changeA0 == 1) { if (movingLeft == 1) movingLeft = 0; else movingLeft = 1; } else if (changeA1 == 1) { if (movingRight == 1) movingRight = 0; else movingRight = 1; } anyChange = 0; changeA0 = 0; changeA1 = 0; } //right { if (changeA2 == 1 && changeA3 == 1) Mouse.click(MOUSE_RIGHT); else if (changeA2 == 1) { if (movingUp == 1) movingUp = 0; else movingUp = 1; } else if (changeA3 == 1) { if (movingDown == 1) movingDown = 0; else movingDown = 1; } anyChange = 0; changeA2 = 0; changeA3 = 0; } } } if (mouseChange > 50) mouseChange = 0; if (movingLeft && !movingRight && mouseChange == 0) Mouse.move(1,0); if (movingRight && !movingLeft && mouseChange == 0) Mouse.move(-1,0); if (movingUp && !movingDown && mouseChange == 0) Mouse.move(0,1); if (movingDown && !movingUp && mouseChange == 0) Mouse.move(0,-1); }
If I recall correctly, the trace from Bill's testing jumped all over the place, so I'm wondering if that's causing the sketch to click continuously. I've written a new versus that reads the sensor 20 times (adjustable) and averages them all together which average is then fed to the range testing.
This is sketch2 ...
Anything seems possible when you don't know what you're talking about.
@will I am currently looking at this code but I am now, of course, having troubles with my Arduino Pico. I have not been able to test this code yet. Now under my ports it is saying that there is no port with the arduino plugged in. I am not sure why this is happening and what went wrong. Of course this all happens before the night it is due.
Of course this all happens before the night it is due.
So this is some kind of class project ?
Anything seems possible when you don't know what you're talking about.
Of course this all happens before the night it is due.
So this is some kind of class project ?
State science fair.
Do I get to share the prize if you win ?
Anything seems possible when you don't know what you're talking about.
@will Im not sure if ill win anything but you are 1000% going into my acknowledgements. youve been a massive help.
@gusmill33 NOOOO, @will get's it all.
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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@gusmill33 NOOOO, @will get's it all.
No way, I don't want to lose control of my self esteem 🙂
Anything seems possible when you don't know what you're talking about.