Asked
— Edited
Here are the errors:
13: Print( "Battery is "$voltageAA )
> Error on line 13: Missing binary operator:
"Battery is " [?] 67
15: Filewriteline( "C:\Users\dylan_000\Desktop\AAlog.txt", $number + 1 ":" $voltageAA)
> Error on line 15: Missing binary operator:
1 [?] ":"
":" [?] 69
Done (00:00:03.7516495)
Here's the script:
:start
$voltageAA = 0
print( "Load battery" )
Sleep(2000)
#Claw closed
servo(d0, 95)
servo(d1, 121)
Sleep(500)
#check and log voltage
$voltageAA = getadc(7)
Print( "Battery is "$voltageAA )
Sleep(300)
Filewriteline( "C:\Users\dylan_000\Desktop\AAlog.txt", $number + 1 ":" $voltageAA)
#claw open
servo(d0, 50)
servo(d1, 150)
Sleep(200)
#door open
servo(d2, 95)
sleep(500)
#door closed
servo(d2, 175)
Goto(start)
What do I have to do to fix them? I'm sure its just my script.
Because you're not appending the variable to the string...
This is wrong:
This is correct:
Without it, you would have to begin understanding binary operations - which you don't, hence the question about the error
But what about the second one. It outputs
to the file. How do I fix that?
It should output
or similar.
It's the same problem. You left out the + operators again:
There has to be a plus sign between each and every separate thing you are trying to combine into one sentence. In this case the + operator is being used in two different ways depending on context. The first one ($number+1), is used as a math addition operator. In the other cases it is being used as an append operator (as DJ mentioned above).
Alright, so spaces vs no spaces. Got it. Will test it tomorrow.
Umm, no. It's not about the spaces. It's about the adding of the plus signs:
I added a space with the colon so as to separate the colon from the $voltageAA value in the output, but that has nothing to do with why it didn't work. For instance:
The spaces between the parts make no difference.
Alright. I'll test it. Thanks.