Go Down

Topic: how do i call a void function() and why does it not compile?! (Read 1 time) previous topic - next topic


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: [Select]

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
  digitalWrite(axisX, LOW);     //end position pulse
  delay(22);                //servo dead time, 22 ms


servoX (int a, int axisX);

Get rid of the yellow bits in the call.

Rob Gray aka the GRAYnomad www.robgray.com

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131