Hi, I am having trouble with syntax or more. I wish to place servo camera positions into an array and then read off the numeric positions in a loop for the servo camera positions and am I struggling.
I have not done arrays since my Basic days in the 80's, all help with my problem will be appreciated.
Snippit of the problem part of my code.
#include <Servo.h>
Servo panservo;
int Down_river = 90; //****************
int Sunderland_1= 100; //
int Sunderland_2= 120; // Views at LW
int Perch = 150; //
int Up_river = 180; //****************
char* myStrings[5]={"Down_river","Sunderland_1","Sunderland_2","Perch,Up_river"};
void setup()
{
panservo.attach(9); // attaches the servo on pin 9 to the pan servo
}
void loop()
{
if (digitalRead(Radar) == LOW){ //read radar for tide height
digitalWrite(TXpwr, HIGH); / / switch on TX
delay(4000); // allow TX to stab.
if (digitalRead(Rain) == HIGH){ //Check for rain
wipeservo.write(wipestartpos);
wipeservo.write(wipeendpos);
wipeservo.write(wipestartpos);
panservo.write(Down_river); // Set cam servo to view start position
delay(25);
}
for (int i = 0; i < 6; i++){
panservo.write(myStrings[i]);
delay(500);
}
}
Hi AWOL,
Yes I would like to keep the named camera positions as these will change and may be added to in the future. As other people may wish to add or remove this positions they make more sense being geographical known points rather than just numbers.
Therefore how do I rectify the code, not sure if my code is totally wrong or it is syntax...google as I may I seem to get more confused....don't take much at 70... :o
Sorry if the code looks fragmented, I clipped quite a bit out so that my array problem would be easier to explain.Some curly brackets may have been deleted when cropped.
The Camera/Transmitter only works if there is enough daylight or measure battery capacity, only does full pans while the tide is navigable.
When unnavigable the Camera/Transmitter will only transmit once every 20 mins of the views that are held in the array.
The reason is that we have limited power on the remote position, Solar/Battery.
The screen wipers are kept to a minimum for wear, there will also be a rain water collection for supplying fresh wiper water if the window has dried salt on it's surface.
The radar is untested as yet as I will hopefully be using a Doppler Radar Module and hope I can read the wave action , backups may be laser or a wired sensor but that would be a last resort especially the latter.
Hi Paul,
Many thanks for you input, I would never have worked that out..thank you.
I will give it a try tonight, see if I can get my head around it.
John