Advertisement
Guest User

Arduino undefined reference to

a guest
Oct 28th, 2013
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.48 KB | None | 0 0
  1. Robot_oct25.ino:
  2. ----------------------------------------------------------------
  3. #include <Wire.h>
  4. #include "armfunctions.h"
  5. #include "defines.h"
  6.  
  7.  
  8.  
  9. void setup(void){
  10.   Serial.begin(9600);
  11.  
  12.   pinMode(READMOTOR1, INPUT);
  13.   pinMode(READMOTOR2, INPUT);
  14.   pinMode(READMOTOR3, INPUT);
  15.   pinMode(READMOTOR4, INPUT);
  16.   pinMode(READMOTOR4, INPUT);
  17.   pinMode(MOTOR1UP, OUTPUT);
  18.   pinMode(MOTOR1DOWN, OUTPUT);
  19.   pinMode(MOTOR2LEFT, OUTPUT);
  20.   pinMode(MOTOR2RIGHT, OUTPUT);
  21.   pinMode(MOTOR3IN, OUTPUT);
  22.   pinMode(MOTOR3OUT, OUTPUT);
  23.   pinMode(MOTOR4LEFT, OUTPUT);
  24.   pinMode(MOTOR4RIGHT, OUTPUT);
  25.   pinMode(MOTOR5OPEN, OUTPUT);
  26.   pinMode(MOTOR5CLOSE, OUTPUT);
  27. }
  28.  
  29. void loop (void){
  30.   while (1){
  31.       readArms();
  32.       delay(1000);
  33.   }
  34. }
  35.  
  36.  
  37. //
  38. //  defines.h
  39. //  
  40. //
  41. //  Created by **** on 25/10/13.
  42. //
  43. //
  44.  
  45. #ifndef _defines_h
  46. #define _defines_h
  47.  
  48. #define MINIMUMMOTOR1     87
  49. #define MAXIMUMMOTOR1     1007
  50. #define MINIMUMMOTOR2     0
  51. #define MAXIMUMMOTOR2     1
  52. #define MINIMUMMOTOR3     0
  53. #define MAXIMUMMOTOR3     1
  54. #define MINIMUMMOTOR4     0
  55. #define MAXIMUMMOTOR4     1
  56. #define MINIMUMMOTOR5     0
  57. #define MAXIMUMMOTOR5     1
  58.  
  59. #define READMOTOR1  A0
  60. #define READMOTOR2  A1
  61. #define READMOTOR3  A2
  62. #define READMOTOR4  A3
  63. #define READMOTOR5  A4
  64.  
  65. #define MOTOR1UP    0   //+
  66. #define MOTOR1DOWN  1   //-
  67. #define MOTOR2LEFT  2   //+
  68. #define MOTOR2RIGHT 3   //-
  69. #define MOTOR3IN    4   //+
  70. #define MOTOR3OUT   5   //-
  71. #define MOTOR4LEFT  6   //+
  72. #define MOTOR4RIGHT 7   //-
  73. #define MOTOR5OPEN  8   //+
  74. #define MOTOR5CLOSE 9   //-
  75.  
  76.  
  77.  
  78. #endif
  79.  
  80.  
  81. //
  82. //  armfunctions.h
  83. //  
  84. //
  85. //  Created by **** on 25/10/13.
  86. //
  87. //
  88.  
  89. #ifndef _armfunctions_h
  90. #define _armfunctions_h
  91.  
  92. #include "defines.h"
  93. #include <Arduino.h>
  94.  
  95. typedef struct{
  96.     float motor1;
  97.     float motor2;
  98.     float motor3;
  99.     float motor4;
  100. }directions;
  101.  
  102. boolean moveArm(char, boolean, short);
  103. void readArms(void);
  104.  
  105.  
  106. #endif
  107.  
  108.  
  109. //
  110. //  armfunctions.c
  111. //  
  112. //
  113. //  Created by **** on 25/10/13.
  114. //
  115. //
  116.  
  117. #include <stdio.h>
  118. #include "armfunctions.h"
  119.  
  120.  
  121. //bool moveArm(char choise, bool direction, short time){
  122.    
  123. //}
  124.  
  125. void readArms(void){
  126.     float motor1 = 0.0;
  127.     int motor = 0;
  128.     motor = analogRead(READMOTOR1);
  129.     motor1 = (float)motor;
  130.     motor1 = (motor1 - 87.0) * (400.0/(1007.0-87.0));
  131.    
  132.     //Serial.println(motor1);
  133.    
  134.     delay(1000);
  135. }
  136.  
  137.  
  138.  
  139. Error:
  140. Robot_oct25.cpp.o: In function `loop':
  141. /Applications/Robot_oct25.ino:29: undefined reference to `readArms()'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement