well this is the program which i copied from a magazine.......
#include <SoftwareServo.h>
#include <SoftwareSerial.h>
#include <VirtualWire.h>
SoftwareServo myservo1;
SoftwareServo myservo2;
SoftwareServo myservo3;
SoftwareServo myservo4;
const int numberOfAnalogPins = 4; // how many analog integer values to receive
int data[numberOfAnalogPins]; // the data buffer
int value[numberOfAnalogPins];
// the number of bytes in the data buffer
const int dataBytes = numberOfAnalogPins * sizeof(int);
byte msgLength = dataBytes;
void setup() {
myservo1.attach(9); //Propeller
myservo2.attach(10); //Radar
myservo3.attach(8); // Aeleron
myservo4.attach(12); // Elevator
Serial.begin(9600);
Serial.println("Ready"); // Initialize the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
vw_set_rx_pin(11);
vw_rx_start(); // Start the receiver
}
void loop(){
if (vw_get_message((byte*)data, &msgLength)) { // Non-blocking
Serial.println("Got: ");
if(msgLength == dataBytes){
for (int i = 0; i < numberOfAnalogPins; i++) {
Serial.print("pin ");
Serial.print(i);
Serial.print("=");
Serial.println(data[i]);
value[i]=map(data[i],0,1023,0,179); // Write into the servo
}
myservo1.write(value[0]);
myservo2.write(value[1]);
myservo3.write(value[2]);
myservo4.write(value[3]);
delay(10);
SoftwareServo::refresh(); //refresh the servo
}
else {
Serial.print("unexpected msg length of ");
Serial.println(msgLength);
}
Serial.println();
}
}
and this is the error......
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'uint8_t SoftwareServo::attach(int)':
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:27: error: 'digitalWrite' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'OUTPUT' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'pinMode' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'void SoftwareServo::write(int)':
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:51: error: 'clockCyclesPerMicrosecond' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In static member function 'static void SoftwareServo::refresh()':
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:73: error: 'millis' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:106: error: 'digitalWrite' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:108: error: 'TCNT0' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:123: error: 'digitalWrite' was not declared in this scope
what is really confusing is that why does it check 'digitalWrite' in 'SoftwareServo'?????
![]()