Pages: [1]   Go Down
Author Topic: how do i call a void function() and why does it not compile?!  (Read 652 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

trying to write a function to output a servo pulse (1.5ms high, 22 ms low) but i do not under stand functions.

into QBASIC i would type CALL xxx
or in ASM i would type RCALL xxx

how do i do this in the arduino?


code will not compile.
Code:
void setup() {
  // put your setup code here, to run once:
  int a = 0;
  int b = 0;

  int axisX = 6;
  int axisY = 7;
  int axisZ = 8;
  int axisA = 9;
 
  int joystickX = 0;
  int joystickZ = 0;
  int triggers = 0;
  int joystickT = 0;
 
  pinMode(axisX, OUTPUT);
  pinMode(axisY, OUTPUT);
  pinMode(axisZ, OUTPUT);
  pinMode(axisA, OUTPUT);
  pinMode(joystickX, INPUT);
  pinMode(joystickZ, INPUT);
  pinMode(triggers, INPUT);
  pinMode(joystickT, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
 
   int a = 1500;
   
   servoX (int a, int axisX);
   
 
}

void servoX(int a, int axisX) {
 
  digitalWrite(axisX, HIGH);    //begin position pulse
  delayMicroseconds(a);
  digitalWrite(axisX, LOW);     //end position pulse
  delay(22);                //servo dead time, 22 ms
}
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 127
Posts: 8517
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

servoX (int a, int axisX);

Get rid of the yellow bits in the call.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: