Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: programming mess up! on: May 19, 2014, 12:14:29 am
I've checked it out and-
1)Suddenly a notification pops up saying that "VirtualWire-1.27" cannot be used.Library names must contain only basic letters and numbers (ASCII only and spaces, and it cannot start with a numbers.) smiley-eek-blue
2)all the libraries are there.
3)SoftwareServo.h has a "#include <WProgram.h>"?
2  Using Arduino / Programming Questions / programming mess up! on: May 18, 2014, 05:54:10 am
well this is the program which i copied from a magazine.......
Code:
#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......
Code:
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'????? smiley-eek-blue smiley-eek-blue
3  Using Arduino / Programming Questions / what does this mean 'val is not declared in this scope'? on: February 10, 2013, 03:07:49 am
Code:
#include <Servo.h>

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo1;  // create servo object to control a servo
Servo myservo2;
Servo myservo3;
Servo myservo4;
 
int potpin1 = 0;  // analog pin used to connect the potentiometer
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;

int val1;    // variable to read the value from the analog pin
int val2;
int val3;
int val4;

void setup()
{
  myservo1.attach(3);  // attaches the servo on pin 9 to the servo object
  myservo1.attach(5);
  myservo1.attach(6);
  myservo1.attach(9);
}
 
void loop()
{
  val1 = analogRead(potpin1);            // reads the value of the potentiometer (value between 0 and 1023)
  (it comes here)
  val1 = map(val, 0, 1023, 0, 179);      // scale it to use it with the servo (value between 0 and 180)
  myservo1.write(val);                   // sets the servo position according to the scaled value
  delay(15);                             // waits for the servo to get there
  val2 = analogRead(potpin2);            // reads the value of the potentiometer (value between 0 and 1023)
  val2 = map(val, 0, 1023, 0, 179);      // scale it to use it with the servo (value between 0 and 180)
  myservo1.write(val);                   // sets the servo position according to the scaled value
  delay(15);                 
  val3 = analogRead(potpin3);            // reads the value of the potentiometer (value between 0 and 1023)
  val3 = map(val, 0, 1023, 0, 179);      // scale it to use it with the servo (value between 0 and 180)
  myservo1.write(val);                   // sets the servo position according to the scaled value
  delay(15);                 
  val4 = analogRead(potpin4);            // reads the value of the potentiometer (value between 0 and 1023)
  val4 = map(val, 0, 1023, 0, 179);      // scale it to use it with the servo (value between 0 and 180)
  myservo1.write(val);                   // sets the servo position according to the scaled value
  delay(15);                 
Pages: [1]