Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory ANY MAC USERS?? on: February 03, 2014, 02:14:19 pm
THANK YOU!!!!!
2  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory ANY MAC USERS?? on: February 03, 2014, 11:16:09 am
No one on MAC?  If this is in the wrong part of the forum, can we move it???
3  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory on: January 31, 2014, 10:10:42 am
Anyone here know someone I can PM for help?  It would be nice to use my working computer.  Arduino is the only thing that I need Windows for.  I would rather not fire up another computer if possible.

I was able to compile code with an install of "Nightly Builds" IDE.  Does this tidbit help diagnose the problem?

Please help!
-e
4  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory on: January 28, 2014, 12:34:00 pm
Anyone on OSX have any ideas how to load ANY sketch?  My PC barely boots up.

I have no idea where to begin.
Thanks!
-e
5  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory on: January 24, 2014, 02:29:16 pm
Thanks again.  When I try the "Blink" example this is what I get:


Code:
Blink.ino:10:21: error: Arduino.h: No such file or directory
Blink.ino: In function 'void setup()':
Blink:15: error: 'OUTPUT' was not declared in this scope
Blink:15: error: 'pinMode' was not declared in this scope
Blink.ino: In function 'void loop()':
Blink:20: error: 'HIGH' was not declared in this scope
Blink:20: error: 'digitalWrite' was not declared in this scope
Blink:21: error: 'delay' was not declared in this scope
Blink:22: error: 'LOW' was not declared in this scope

Thanks
-e
6  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory on: January 24, 2014, 08:58:58 am
Thanks for the reply.  I have un-installed and re-installed.  I have restarted my computer...  I have even crossed my fingers.

On Mac I click download, and when the download is complete I can open the IDE.  I have moved it into my Applications folder and it launches as soon as I click on it.  There is no way I can see for that to go wrong. 

On PC, it downloads a zip and there is an install "process".  I have never had a problem with Arduino and PC (other than a lack of coding knowledge). 

Could it be a Java thing by chance?  I will update to the latest Java, uninstall and reinstall the IDE and see what comes of this.

EDIT: does it matter that I am on "Mavericks" OSX 10.9.1?
 
7  Using Arduino / Installation & Troubleshooting / Re: Arduino.h no such file or directory on: January 23, 2014, 10:35:22 pm
If this should be moved to Programming Questions, please do. 

Any ideas?
Is it as simple as locating a file named "Arduino.h" and putting it in the right place?  If so where should it go? 

I just downloaded the same version on PC laptop and I can play, but I work mostly on Mac as my laptop is very old.
Thanks!
-e
8  Using Arduino / Installation & Troubleshooting / Arduino.h no such file or directory ANY MAC USERS?? {SOLVED} on: January 23, 2014, 01:33:25 pm
Sorry if this is asked and answered, but I have had no luck with the search function.  

I recently installed v 1.0.5 and every sketch I try to compile or upload comes up with errors, the first of which
Code:
Arduino.h no such file or directory
Even the blink sketch.

I can compile and upload in v21, but the project I am wanting to tinker with (Bleep Labs Bleep Drum) is .ino not .pde

Please be gentle, but I really need help.  I have spent several hours fumbling through google searches on this to no avail.

I am very much out of practice, and when I was on PC (I got a Mac a year ago) and versions 17-21 I was at least able to play with blinking LEDs.

I can provide any more info if needed
Thanks!
-e


Please
9  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 20, 2012, 10:05:17 pm
Thanks for the replies!  I haven't removed the LEDs yet, but the PING example returns very consistent readings.  I will try that next.  I am using a 4-pin (HC-SR04) sensor.

I have tried commenting out everything having to do with the LEDs and the serial info is still all over the place.  I am at a loss right now.  I will keep plugging away.

Thanks!
--e

I have also tried another Arduino (Duemilanove) with less LEDs and I get the same results.
10  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 20, 2012, 08:58:41 am
Thanks for the replies.  The range I was referring to is the limits of the ping (6600ms) not the range of the servo.  The servo has 180 degrees of motion and I don't think my code goes beyond this, correct?  I tried to sweep only 160 degrees in an earlier revision and that is what the commented code reflects, but this is in fact a 180 degree servo.  By verified, independently, do the package labels and product manuals count?  Other than that, the servo sweep example works fine.  The jitter/ pulse/ heating up I have issue with id when the motor does not completely STOP when the constraint of duration (6600) is reached.

The servo was pulsing (not completely off) when the sensor was reading around 6600 for duration.  While the sensor is consistently returning a value of less than 6600, the servo moves fluidly 180 degrees.


As far as what is :

Code:
  int sensorReading = digitalRead(pingPin);

Quote
What is this, in getDuration(), doing?

My friend that helped me clarify the code was working on a "buffer" where it looks for multiple readings longer than the expected duration.  The thought was to reduce the jitter, it was a variable to be called on in another idea. 

Basically another line I should have deleted before asking for advice.


My current goals are:
More accurate scaling/ reading of the ping sensor
----The readings bounce all over the place while the servo is connected.  Should I employ a greater than but less than range for this? 

If I could find out why the ping readings are inconsistent while the servo is connected I think the duration of 6600 would accurately "turn on and off" the device.  There is erratic behavior with the LEDs and the servo when it is "about to turn off".   

Is it possible that the LEDs (or even just the amount of them) is causing the PING sensor to not get consistent voltage from the 5v pin on the arduino?

Thanks for reading.
-e

11  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 19, 2012, 06:56:42 pm
I'm sorry.  I am not trying to waste anybody's time.  I should have removed the commented part,  It was in there from a previous revision.  I am not trying to offend anyone.  I am unaware if this is bad forum etiquette.

The servo would pulse and get hot while at the edge of the range.  I put in the detach to stop the servo's jitter while the ping is out of range.  Is there a better way to do this?

The serial.begin is commented because the servo AND the LED behavior was erratic with it un commented.  Is this normal?  No I did not read serial output with this commented.

Please suggest improvements.  I am trying to learn how to do this better, but don't know how to ask the right questions.
thanks
-e


 
12  Topics / Interactive Art / Re: Seedstudio Music Shield + Proximity Sensor? on: August 18, 2012, 11:39:20 pm
I haven't tried anything like that yet.  I am going to try some more with music shield soon too.  I have been tinkering with a random state for music shield so it doesn't always play songs in the loaded order, but haven't gone too far there either.

Good luck!  I will keep checking here to see what progresses too.
-e
13  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 18, 2012, 11:24:40 pm
Thanks for the help!!  I had a friend of mine help with my code.  I have a couple of questions that he couldn't answer. 

Now I have the ping sensor, servo, and LEDs mostly working.  However, while the servo is connected (and powered externally with grounds connected), the range on the ping sensor is inconsistent.  We verified this with serial monitor too.  I got most of what I wanted out of this sketch, but if anybody can suggest a "slicker" way to do any of this, or possibly help to explain why having the servo in the circuit causes anomalies, this would be awesome.

I'm not sure if this matters, but I am using the Mega 2560, as I quickly ran out of pins on my others.  If switching boards might help minimize conflict this is not a deal breaker.  Could another sensor be a better choice?

Thanks!
-e


Revised code:
Code:
const int pingPin = 20;
const int NUMLEDS = 18;
byte pin[NUMLEDS] = {
  2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
byte state[NUMLEDS] = {
  LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW};
unsigned long interval[NUMLEDS] = {
  400, 500, 1000, 722, 750, 325, 200, 800, 5000, 250, 1000, 300, 775 , 1000, 300, 500, 400, 250};
unsigned long time[NUMLEDS];
unsigned long servotime;

unsigned long degree_interval = 20;


#include <Servo.h>

Servo myservo; 

int servo_degree = 0; // variable to store the servo position
boolean forward = true;
long duration;

void setup()
{

  // initialize serial communication:
  //Serial.begin(9600);
 
  for (int i=0; i<NUMLEDS; ++i){
    pinMode(pin[i], OUTPUT);
  }

  myservo.attach(21);  // attaches the servo on pin 21 to the servo object
}

long getDuration(){
 
  int sensorReading = digitalRead(pingPin);
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  return duration;
}

void loop()
{
  //Serial.println();
  duration = getDuration();


  unsigned long m = millis();
 
  /*
  for(pos = 0; pos < 160; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'

  }
  for(pos = 160; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'

  }
  */



    if (duration <= 6600){
     
     
      for (int i=0; i<NUMLEDS; ++i){
        if (m - time[i] > interval[i])
        {
          time[i] = m;
          state[i] = state[i] == LOW ? HIGH : LOW;
          digitalWrite(pin[i], state[i]);
        }
      }
     
     
      if( m - servotime >= degree_interval){
        myservo.attach(21);
        myservo.write(servo_degree);
       
        if(servo_degree >= 180){
          forward = false;
        }
        if(servo_degree <= 0){
          forward = true;
        }
       
        if(forward){
          servo_degree++;
        }
        else{
          servo_degree--;
        }
       
        servotime = m;
     
      }     
     
    }
    else{
      myservo.detach();
    }



}
14  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 15, 2012, 11:40:45 pm
Thank you!  I am in fact using pin 21 for the servo, I just didn't change the comment.  I will look into your suggestion.   I am very in experienced with this stuff, but i do want to learn.

Thanks!
-e

15  Using Arduino / Programming Questions / Re: Multiple LEDs blinking at different intervals plus servo sweep on: August 15, 2012, 10:27:31 pm


Ok.  I have made minute progress.  Here is the current code:


Code:
const int pingPin = 1;
const int NUMLEDS = 18;
byte pin[NUMLEDS] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
byte state[NUMLEDS] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW};
unsigned long interval[NUMLEDS] = {100, 500, 1000, 722, 750, 325, 40, 800, 5000, 250, 1000, 1000, 1000, 50, 7500, 500, 400, 250};
unsigned long time[NUMLEDS];



#include <Servo.h>
 
Servo myservo; 
 
int pos = 0;   
 
void setup()

{
 for (int i=0; i<NUMLEDS; ++i)
   pinMode(pin[i], OUTPUT);

  myservo.attach(21);  // attaches the servo on pin 9 to the servo object
}
 
 
void loop()
{
 
  int sensorReading = digitalRead(pingPin);
  long duration;
   pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
 
 
  unsigned long m = millis();
  for(pos = 0; pos < 160; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
   
  }
  for(pos = 160; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
   
  }
 
  {
 
if (duration <= 6600)
 for (int i=0; i<NUMLEDS; ++i)
   if (m - time[i] > interval[i])
   {
     time[i] = m;
     state[i] = state[i] == LOW ? HIGH : LOW;
     digitalWrite(pin[i], state[i]);
   }
if(duration >=6599)
myservo.write (0);
   
} }

First, the 6600 is arbitrary, but puts the distance pretty close to a kid knocking on a door and saying "trick or treat"

This does most of what I was hoping to accomplish.  I am able to flash many LEDs at different rates while the servo sweeps and it works with proximity.  I do have two unexpected results.  The servo continues to move (rapidly) back and forth while out of range (this is why I tried the
Code:
if(duration >2200) myservo.write (0)
, but it does not seem to change this), and the servo sweeps a bit erratic while in range (I am only going based on trial and error and have had some luck).  This is not a deal breaker, as I feel I have been moderately successful.

If someone could help me understand what I am doing wrong, and if there is any way to shorten/ revise my code that would be awesome.  I pretty much have the functionality I wanted, but I would like a more polished result.  I would also rather not burn up a servo too if there is a way to make it run properly. 

So I am in need of a tiny bit of guidance on making the servo sweep to take a bit longer, and stopping it when out of range.

Thanks!
-e
Pages: [1] 2 3 ... 7