Originally Posted by
freelander-rider
I have copy and pasted the edited code, but when I upload it lists error on line 34 " void loop function not in scope" and many errors on most lines after this.
I'm not sure but it would seem by removing the header "# Servo h" which I believe is from the servo library, and I assume contains commands and variables which are possibly required for the code, this may be one of the problems,
in your setup you are using servo's which have a feedback signal to operate the doors, in my setup I want to use actuators on output B for the doors rather than servo's," ie actuators 2 wire no feedback".
Would I still need the " #Servo h" header even though I wont use servo's, just to allow "#Servo h" library to send the signals and variables to action the actuators on output B.
I am still confused with other parts of the code, ie"if( updwn= =1 && senserValueB < limitB &&iB= =0)", what is this and where do the sensor values come from,I know this works with your original code.
I feel like I'm driving onto a roundabout without knowing which exit to use, I have trawled through many examples of codes and meanings, but finding it hard to correlate the various commands and variables required,to do these functions in the correct sequence.
I could do with some help with this,as I seem to be going round in circles looking for a solution.
Mike
You don't need servo library if you're not using servos. The servo library allows you to ask the servos to move to a set value or position. this is usually a value between 600 and 2400. 600 being one end of the servo travel and 2400 the other end.
( updwn= =1 && senserValueB < limitB &&iB= =0) shouldn't be a space between the 2 equals... ==. what it says is updwn must exactly equal 1 and (&&) the sensorValueB (not senser) must be less than(<) the limit value (the limit value is set at the start of the code, int limitA 550 and int limitB300). And (&&) the value iB must be equal to (==) 0. All these conditions need to be meet or it does something else, hence the else statement.
In the code we use variables these have no pin assignments and are just a variable value. for instance i create a variable called sensorValueA. in the code you have to tell the program that you have created this thing called sensorValueA hence the need to state at the start or before you use it 'int sensorValueA' now the code knows to expect this within the program. its like creating a word in a language. If i invent a word.. windllydangfinc no one will believe the word exists until someone puts some meaning to it and puts it in a dictionary. in the code this is what int is doing, creating the instance (int) of this sensorValueA. later we give it a definition which in this piece of code can change because it is a value that we get from reading the value on sensorPinA ...sensorValueA = analogRead(sensorPinA). analogRead(sensorPinA) is telling the code to read what analog value it has on the sensorPinA (sensorPinA is pin A0 on the arduino board). This will return a value which is the load on your motors.
Hope this helps. One other thing, you must be very careful with your typing spaces and caps make a difference in code writing. the code will not assume that if you write senser PinA you actually mean sensorPinA, it will just send an error.