Thanks Mike. I'm using Mach 3 (Paid Version) for most of my CNC Needs but I want to use this on on a mini-Surface Grinder I have built.
I must confess this Arduino thing is a bit of a beast, it is a bit like my little Jack Russel Terrier - Only does what you want him to do when he thinks fit. If he had two fingers I know what he would do sometimes. I'll take a look at this GRBL stuff shortly. Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want to use Case Select to step through 5 options but I'm failing miserably. What I have so far after 3 hours is:-
BTTNPUSH = READAD10(AN0)
ButtonRight = BTTNPUSH < 50
ButtonUp = BTTNPUSH >60 and BTTNPUSH < 200
ButtonDown = BTTNPUSH >200 and BTTNPUSH < 400
ButtonLeft = BTTNPUSH >400 and BTTNPUSH < 600
ButtonSelect = BTTNPUSH >600 and BTTNPUSH < 800
Select Case ButtonDown = 1
Case 0
CLS
PRINT "Option 1 "
; Print ButtonRight
Case 1
CLS
PRINT "Option 2"
Case 2
CLS
PRINT "Option 3"
Case 3
CLS
PRINT "Option 4"
Case 4
CLS
PRINT "Option 5"
End Select
What I want to happen is everytime I hit Buttondown it advances through the options then resets back to the beginning.
This is beginning to make one of my other hobbies "Recreational Chemistry" look appealing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You need a state engine. This means for that you have a tracking variable.
Set the variable and then increment each time then reset when a maximum value is met. There are many ways to do this but this is simple way to do it. ( Untested)
DimButtonStateasByteButtonState=0DoBTTNPUSH=READAD10(AN0)ButtonRight=BTTNPUSH<50ButtonUp=BTTNPUSH>60andBTTNPUSH<200ButtonDown=BTTNPUSH>200andBTTNPUSH<400ButtonLeft=BTTNPUSH>400andBTTNPUSH<600ButtonSelect=BTTNPUSH>600andBTTNPUSH<800ifButtonDown=TrueThenSelectCaseButtonState=1Case0CLSPRINT"Option 1 "Case1CLSPRINT"Option 2"Case2CLSPRINT"Option 3"Case3CLSPRINT"Option 4"Case4CLSPRINT"Option 5"CaseElseButtonState=0EndCase'increment the stateButtonState++Loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you so much once again Evann. This is crazy I know but I still cannot get it work as it should, for some apparent reason it needs an End If somewhere in response to the
if ButtonDown = True Then
condition. I have tried it in every conceivable position as I feel it is that which is preventing it from stepping through the case statements.
I don't what it is but I don't seem to come across as many basic low level problems with Microchip devices ? This Arduino business is taking my programming skills back to scratch one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Line 28.. looks incorrect but this will not impact the CASE statement.
This is the issue
Line 79 Select Case SelectButton = 1 should read Select Case SelectButton
The existing line 79 will operate the case then SelectButton is 1 and the only case will look for a value of 255 for the case.... But, Select Case SelectButton will do what you want.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@ Anobium. Crying out loud, this is really getting to me but I'm not giving up just yet. Take a look at the video below, you won't believe what it is doing. The full code is also attached.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@ Anobium. Crying out loud, this is really getting to me but I'm not giving up just yet. Take a look at the video below, you won't believe what it is doing. The full code is also attached.
Last edit: Keith 2022-09-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Video is too big to upload. I need to convert it on my other PC to show you what it is doing. Unless you can try it out on one of your UNO's as I have a feeling the CPU on this thing may be damaged.
Some of the problems I'm having is beyond comprehension. GRRR !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Don't give up. I am out today. So, I have adapted the program to help isolate this issue.
I have removed the ADC read and set a return value of 201. This will simulate the button press. I get the menus cycling thru the options 1 to 6. What do you get?
If I press and hold the down key the display cycles through all the options but it advances randomly on a single one shot of the down key. It's as if the down button needs a de-bounce routine.
Secondly any instruction within the case options are ignored such as in "If ButtonSelect > 0 Then
Case 0
CLS
PRINT "Option 1 "
Locate 1,5
If ButtonSelect > 0 Then
Goto Test
End if
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Mike. I'm using Mach 3 (Paid Version) for most of my CNC Needs but I want to use this on on a mini-Surface Grinder I have built.
I must confess this Arduino thing is a bit of a beast, it is a bit like my little Jack Russel Terrier - Only does what you want him to do when he thinks fit. If he had two fingers I know what he would do sometimes. I'll take a look at this GRBL stuff shortly. Thanks again.
I want to use Case Select to step through 5 options but I'm failing miserably. What I have so far after 3 hours is:-
BTTNPUSH = READAD10(AN0)
ButtonRight = BTTNPUSH < 50
ButtonUp = BTTNPUSH >60 and BTTNPUSH < 200
ButtonDown = BTTNPUSH >200 and BTTNPUSH < 400
ButtonLeft = BTTNPUSH >400 and BTTNPUSH < 600
ButtonSelect = BTTNPUSH >600 and BTTNPUSH < 800
Select Case ButtonDown = 1
Case 0
CLS
PRINT "Option 1 "
; Print ButtonRight
End Select
What I want to happen is everytime I hit Buttondown it advances through the options then resets back to the beginning.
This is beginning to make one of my other hobbies "Recreational Chemistry" look appealing.
You need a state engine. This means for that you have a tracking variable.
Set the variable and then increment each time then reset when a maximum value is met. There are many ways to do this but this is simple way to do it. ( Untested)
Thank you so much once again Evann. This is crazy I know but I still cannot get it work as it should, for some apparent reason it needs an End If somewhere in response to the
if ButtonDown = True Then
condition. I have tried it in every conceivable position as I feel it is that which is preventing it from stepping through the case statements.
I don't what it is but I don't seem to come across as many basic low level problems with Microchip devices ? This Arduino business is taking my programming skills back to scratch one.
I can help. :-)
Post what you have.
Here is what I have so far. I changed the names of a couple of variables as the original ones clashed with what I had.
Line 28.. looks incorrect but this will not impact the CASE statement.
This is the issue
Line 79
Select Case SelectButton = 1
should readSelect Case SelectButton
The existing line 79 will operate the case then SelectButton is 1 and the only case will look for a value of 255 for the case.... But, Select Case SelectButton will do what you want.
Anobium. If instead of a pin for each button , this using just one a-d to read 5 buttons is cool?
Yes Stan but it is a real Pain in the Butt to get to work properly !
@ Anobium. Crying out loud, this is really getting to me but I'm not giving up just yet. Take a look at the video below, you won't believe what it is doing. The full code is also attached.
@ Anobium. Crying out loud, this is really getting to me but I'm not giving up just yet. Take a look at the video below, you won't believe what it is doing. The full code is also attached.
Last edit: Keith 2022-09-22
Code as in above
Last edit: Keith 2022-09-22
Video is too big to upload. I need to convert it on my other PC to show you what it is doing. Unless you can try it out on one of your UNO's as I have a feeling the CPU on this thing may be damaged.
Some of the problems I'm having is beyond comprehension. GRRR !
Don't give up. I am out today. So, I have adapted the program to help isolate this issue.
I have removed the ADC read and set a return value of 201. This will simulate the button press. I get the menus cycling thru the options 1 to 6. What do you get?
and, my hex to rule out your installation....
If I press and hold the down key the display cycles through all the options but it advances randomly on a single one shot of the down key. It's as if the down button needs a de-bounce routine.
Secondly any instruction within the case options are ignored such as in "If ButtonSelect > 0 Then
Case 0
CLS
PRINT "Option 1 "
Locate 1,5
If ButtonSelect > 0 Then
Goto Test
End if
My new ebay listing for some LGT UNO boards.
https://www.ebay.co.uk/itm/204291606186?mkevt=1&mkpid=0&emsid=e12000.m113256.l116967&mkcid=7&ch=osgood&euid=a5027db800b74faab23ddcc6624ec8f0&bu=43054004545&exe=104326&ext=245516&osub=-1%7E1&crd=20230401001150&segname=12000&mkevt=1&mkpid=0&emsid=e12000.m113256.l116967&mkcid=7&ch=osgood&euid=a5027db800b74faab23ddcc6624ec8f0&bu=43054004545&exe=104326&ext=245516&osub=-1%7E1&crd=20230401001150&segname=12000
You got competition. There's interpreted basic for these but they are so fast it doesn't need compiling. https://www.adafruit.com/product/4864
LOL.... does that BASIC do PIC? LOL