Asked
— Edited
Can you show me some examples in Javascript of how to Setashome for V21? Can you also show me some examples in Javascript of how to Calibrate V22?
Related Hardware EZ-B v4
Related Controls
Stepper Servo
Inverse Kinematic Arm
I have inserted the code below it as you have mentioned and I took off the comments on debug. Made it go to position 1000 saw the RX led come on, ran the Home V1 code saw the RX led come on. Set the position to 1, saw the Rx led come on and it went 1000 steps back to 1(which it should not have moved). There is nothing connected to pin 13 on Mega or Uno. Does it have anything to do with setcurrentposition (0) which must mean cmd==0 rather than (0) zero in parenthesis being a position 0 which in AutoPosition means release and keep that position as is? Do I need to tie an led to pin 13 or is there supposed to be an led built into Uno and Mega because no other led is turning on other than RX when I send a position or Home command?
Move that led debug code into other cmd conditions to make sure it works. Or put it back outside of the cmd if condition and it should light for all commands. Just make sure it works before you start spinning in circles.
and no, everything you wrote about Auto Position and cmd = 0 is way off base. Cmd=0 just means 0 is setashome. And cmd is the variable that stores the cmd being sent. It has no relation to anything else. It’s an IF condition and cmd is a variable.
Just a question on this tread. Have been following it and curious why you have a "!' in front of the digitalRead(LED_BUILTIN));
OK I will have to make the changes later tonight or in the morning. I am at work now and I understand about the CMD. Thanks for explaining. Herr I will look into the ! Up until today I have not done any editing below the area where it says do not edit here so that must have been there before
A question mark means NOT
If (2== 2) print(yes)
if (2 != 3) print(yes)
if you use it in a Boolean then it’s NOT true or NOT false
bool variable = false
if (!variable) print(yes)
that’s the same as.
if (variable == false) print(yes)
@Herr Ball if you were looking for more context, it looks like they are using the NOT to toggle the LED from its last state. This is common in debugging. If the LED was ON now turn it OFF, if it was OFF now turn it ON.
I have been studying Python and " != " means not equal to. I seen the ! and wondered if it was accidentally placed there or the = sign was forgotten. Didnt mean to high jack this thread.
Herr Ball,
the ! means NOT... so you can use it where ever you'd use NOT. It's used in all programming languages, such as C, C++, Python, C#, JavaScript, Java, etc.......