Show Posts
Pages: [1] 2
1  Using Arduino / Installation & Troubleshooting / Re: Serial Port Greyed Out on: April 04, 2012, 12:31:18 pm
I had the same problem on this PC, did the driver install, it worked fine until I unplugged the Uno, and plugged it back in. Now serial port is greyed out again, and I can't upload a sketch, but the port is set up and the drivers installed. What next?
2  Forum 2005-2010 (read only) / Troubleshooting / Arduino folder is empty after install on: May 03, 2010, 08:01:46 pm
I have a student with a MacBook Pro running 10.6.3.  He installed Arduino 18, I went to put the libraries he needed into the libraries, but there is no libraries folder where I'd expect it...in fact the Arduino folder was completely empty.  We tried installing 17 just to see, and the same thing is happening.  When we run the Arduino IDE we can pull up and load the example sketches, so they are somewhere.  I even had another student take a look to make sure I'm not crazy.  Any ideas?  Suggestions?  thanks.
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: timing without using delay on: December 07, 2007, 11:51:22 pm
Okay - first off this is great stuff, and thanks for all the advice.  

Secondly, though, I have to mention that my niche in teaching microcontrollers is teaching beginners how to program them.  While some of my students could be shown arrays, and how they work, I don;t have the majority of my students for a long enough stretch of time to go there.  Any chance any of you feel like having a crack at this one from other angles?  And not necessarily the tersest or most efficient ways, but some that are easier for the relative newcomer to get.  I'll keep all the examples together to show them of course...options are important.

Thanks again for the help btw!
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: timing without using delay on: December 07, 2007, 04:43:21 pm
Okay, after reading thru I get how (and why) to keep my various actions and such in arrays.

What do these lines do and what is the significance of the splats and ampersands?
 
char ***current_actions = &loop_actions;
int **current_times = &loop_times;
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: timing without using delay on: December 06, 2007, 08:01:44 pm
wow....well that there is a *WHOLE* lot of Arduino for me to chew on, that's for sure.

Good thing it's nearly the weekend :-)

As I read through some of the other responses I get the feeling that I was misinterpreting how attachInterrupt and delay and millis may or may not interact...I will check those assumptions this weekend.


btw - I'm starting to have flashbacks to 20 years ago when I decided to be a sculptor instead of a programmer - and now they are merging...merging like an egg and the sidewalk from 10 stories up ;-)
6  Forum 2005-2010 (read only) / Syntax & Programs / My code at the moment on: December 06, 2007, 06:08:01 pm
You all make some good points, so here is my code (up until now).  Before you read it let me describe what is going on - the viewer approaches the piece (a "genie") and places their beverage into its hand.  The weight of the drink activates a lever switch and the Arduino runs the main routine.  Because void loop is running in a loop the piece doesn't react immediately - that is where I want to use the first interrupt.  Once the "main show" function is running, I want the removal of the drink to send execution back to void loop.  The code you see here is what I wrote in the gallery with little time to spare before the show opening - and having been awake for 28 hours to boot.  The eventual program will have more action - but I want to try to incorporate those interrupts before I head down that path.  Thanks for looking!  

Pix to help explain the thing - http://www.flickr.com/photos/shifzr/2055471345/ - http://www.flickr.com/photos/hackaday/2055635032/


int inPin = 7;   // lever switch connected to pin 7
int val = 0;     // switch read value

/*
Lynxmotion channels:
2 - fortune card servo
7 - eyes servo
11 - head servo
15 - jaw servo
16 - chamber LED
17 - status check LED
19 - status check LED
22 - panel LED
24 - panel LED
26 - panel LED
28 - hand LED green
29 - hand LED red
serial Rx

Arduino channels:
1 - serial Tx to Lynxmotion
7 - arm switch
*/


void setup()
{
  Serial.begin(9600);
  pinMode(inPin, INPUT);      // sets the digital pin 7 as input
}
 
 
 void loop()  //loop contains default resting behavior
{
  if (!digitalRead(inPin))   // read the arm switch, if not down run default
  {
  Serial.println("#17H #19L #24L #22L #25H #26L #28H #29L"); //initialize LEDs
  Serial.println("#2 P1900 S350"); //slowly return fortune servo
  Serial.println("#7 P1500 #15 P1500 #16L"); //eyes slow, mouth closed
  Serial.println("#11 P600 S200 #17H #19L"); //head slow
  delay (2000);
  Serial.println("#11 P1600 S150"); //head slow
  delay (2000);
  }
  else //if arm is down run the following function
  {
  run_main_show();
  }
}


void run_main_show()
  {
  Serial.println("#7 P1520 #15 P600 #11 P600 #17L #19H #28L #29H");  //eyes stop, head back, mouth closed
  delay (3000);
  Serial.println("#7 P1400"); //move eyes fast
  Serial.println("#11 P700 S300"); //head faster
  //Serial.println("#15 P600"); //mouth open
  delay (2000);
  Serial.println("#11 P1300 S300"); //head faster
  Serial.println("#15 P1500"); //mouth closed
  delay (2000);
  Serial.println("#7 P1520 #15 P1500 #11 P600 #24H");  //eyes stop, head back, mouth closed
  delay (4000);
  Serial.println("#15 P600"); //mouth open quick
  delay (150);
  Serial.println("#15 P1500"); //mouth closed quick
  delay (150);
  Serial.println("#15 P600"); //mouth open quick
  delay (150);
  Serial.println("#15 P1500"); //mouth closed quick
  delay (150);
  Serial.println("#15 P600"); //mouth stays open 2 seconds
  delay (2000);
  Serial.println("#16H #24L"); //chamber lights on, panel light off
  Serial.println("#15 P1500"); //mouth closed
  delay (6000);
  Serial.println("#2 P600 S500 #22H #16L"); //fortune kicks first time, fortune panel light on, chamber light off
  delay (1500);
  Serial.println("#2 P1500"); //slowly return fortune servo part way back
  delay (1500);
  Serial.println("#2 P600 S500 #22H"); //fortune kicks second time, fortune panel light on
  delay (2000);
  Serial.println("#2 P1900 S350"); //slowly return card servo
  Serial.println("#26H #22L"); //remove drink light on, fortune light off
  delay (10000);
  
}




7  Forum 2005-2010 (read only) / Syntax & Programs / Re: timing without using delay on: December 05, 2007, 08:29:21 pm
yea, but I'm looking more for how to fish than people re-writing my fish.  How's that for a mixed metaphor? :-D

It's more a generic question that's been on my mind, i.e. learning all the possible ways to create delays without using delay(), than just this one case on this one piece.

Oh and in that example you link to - it uses millis...Can't use millis with interrupts either :-(
8  Forum 2005-2010 (read only) / Syntax & Programs / timing without using delay on: December 05, 2007, 07:21:40 pm
I wrote the code for a piece of art I just built in a big hurry (i.e. just hours before the gallery doors opened).  The easiest way for me to create the timings I wanted between events was with delay statements.  Trouble is I really need to implement interrupts in the code, and I can't use delay in my interrupt handling functions.  So what I am looking for is general advice in the ways one could create the timing they desire without the use of the delay command.

Thanks in advance for any advice.

-CTP
9  Forum 2005-2010 (read only) / Syntax & Programs / using interrupts...basic use query on: November 19, 2007, 01:09:50 am
On the piece I am currently building I have an switch that the viewer can effect, and my sketch looks for the state change in the loop() function.  Once it reads the switch, and it has been effected, the program moves to another function and runs until the end.  What I would like to do is two things - 1) use interrupt(s) so that as soon as the viewer effects the switch it jumps to the second function...so far so good, I think I can handle this no problem.  The second thing though, is that if the viewer decides to move on I want it to return to the loop() function instead of continuing execution in the longer second function.

My question, is it simply a matter of using the two interrupts in a complimentary fashion?  Is there any problem with this working?  Any gotchas?  Anyone ever do something similar?  Anyone have any examples?

I am going to work on it in the morning...I wouldn't even normally ask such a general question without hacking on it for a while, but me and my sculpture leave for Vienna Wednesday morning and I really want to get it to work the way I want.  Many thanks in advance!!!

Here is where I am going btw - http://www.roboexotica.com/
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: another function problem on: November 15, 2007, 08:35:48 pm
argh...LOL...twice now I'm doing everything right and some little weird thing gets me.  BTW - Is there a way in Arduino to explicitly declare a function?  Not that I need it, just curious.


Ah well, away I go.  I doubt you've heard the last of me - I have to get this piece ready to go to Vienna with me Wednesday morning.  Nothing like a deadline to help learn a new programming language, eh?  ;D


Many thanks!
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: another function problem on: November 15, 2007, 02:00:44 pm
Here is the whole thing as it sits now.  At the moment all I was doing was using the LED to try calling the other function (meaning as a diagnostic indicator).  My code for driving a serial servo controller, among other things, will eventually go in instead.

int ledPin = 13; // LED pin 13
int inPin = 7;   // switch pin 7


void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  pinMode(inPin, INPUT);      // sets the digital pin 7 as input
}

void loop()  //default resting behavior
{
  if (digitalRead(inPin))   // read the arm switch
  {
  digitalWrite(ledPin, HIGH);
  delay (50);
  digitalWrite(ledPin, LOW);
  delay (50);
  }
  else
  {
  run_main_show();
  }
}

void run_main_show() //run show script here
  {
  digitalWrite(ledPin, HIGH);
  delay (5000);
  }
12  Forum 2005-2010 (read only) / Syntax & Programs / another function problem on: November 15, 2007, 01:32:12 pm
Simple example.  I want a condition in my main loop to start another function - in this case the piece of art does certain things while at rest, then when a button is pushed it does its full show.  

void loop()  //default resting behavior
{
  if (digitalRead(inPin))   // read the switch
  {
  do some stuff;  //
  }
  else
  {
  run_main_show();
  }
}

void run_main_show() //run show script here
  {
  do some other stuff;
  }

This example is just for one button and one show, but I envision cases where I want more functions... i.e. "why not just put your code in the main loop instead of another function?" isn't the answer I'm looking for...although I suppose it may be the actual answer.

Anyway, the error I get is "'run_main_show' was not declared in this scope".  Which makes some sense, but how do I make the compiler happy when calling functions?
13  Forum 2005-2010 (read only) / Development / Arduino IDE and XO laptop.... on: November 17, 2007, 11:01:50 pm
Just wondering if anyone else has pondered the possibility of using an XO laptop to program Arduinos.   smiley-grin

http://laptop.org/laptop/
http://laptop.org/laptop/hardware/highlights.shtml
http://laptop.org/laptop/hardware/features.shtml
http://laptop.org/laptop/hardware/specs.shtml
14  Forum 2005-2010 (read only) / Troubleshooting / Re: Need help, FAST (please) on: November 28, 2007, 03:38:23 pm
<<<You should try setting upload.verbose to true and seeing the full output of the upload attempt. >>>

I will try that.  I got home last night around 3AM and came into the office this morning - my body doesn't really know what time it is yet.  As soon as I unpack I will set up the sculpture and try it.

I thought of uploading a tiny sketch to it, but then realized that it was currently running a sketch that if all else failed would at least animate the piece somewhat - and if I changed that and couldn't go back, and couldn't get the new board to work, that I would be 100% screwed.
 
<<<Did you try uploading a simple sketch to the board?>>>
Yea, the entire sketch for the piece is pretty simple as it is - around 2K is all in its current form.

I soldered together the other board in the gallery, hooked it up, and it worked all though the show so everything worked out in the end.  I'll start hacking on the other board tonight or tomorrow.
15  Forum 2005-2010 (read only) / Troubleshooting / Re: Need help, FAST (please) on: November 22, 2007, 10:27:22 am
Okay - I worked out the trouble with the bare bones board and am starting my programming - <3 hours until the show opens...no sweat :-)

I still wonder what is going on with the other board, but the panic is at least abated for now.
Pages: [1] 2