Show Posts
Pages: 1 [2] 3
16  Using Arduino / Project Guidance / Re: ARDUINO as a RPM limiter on: February 11, 2013, 07:34:20 pm
I would be interested in this for an automotive application any way to get over the overheating issue?

Lance
17  Using Arduino / Project Guidance / Can't write multiple pins HIGH why? on: February 11, 2013, 07:32:55 pm
Here is my code:

Code:
int ledI = 13;
int ledL = 12;
int ledO = 11;
int ledV = 10;
int ledE = 9;
int ledY = 8;
int ledo = 7;
int ledU = 6;

void setup() {               
 
  pinMode(ledI, OUTPUT); 
  pinMode(ledL, OUTPUT);
  pinMode(ledO, OUTPUT);
  pinMode(ledV, OUTPUT);
  pinMode(ledE, OUTPUT);
  pinMode(ledY, OUTPUT);
  pinMode(ledo, OUTPUT);
  pinMode(ledU, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  delay(100);
  digitalWrite(ledI, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(ledI, LOW);    // turn the LED off by making the voltage LOW
  delay(3000);               // wait for a second
  digitalWrite(ledL, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(ledL, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledO, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledO, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledV, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledV, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledE, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledE, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledY, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledY, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledo, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledo, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  digitalWrite(ledU, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(3000);               // wait for a second
  digitalWrite(ledU, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

I then wanted the led I, L, O, V, E, Y, o, U to write high and tried to use digitalWrite but it errored on me. What should I use in its place?

Thanks
18  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 20, 2012, 07:36:35 am
James,

   So it looks like I can continue on with my proto board bootloader installation shield to burn the bootloader but in order to install a program on the new chips I still have to remove the ATmega from the Arduino.

   Could you steer me in a direction of reading about how to program any chip without an arduino platform?

Lance
19  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 19, 2012, 11:06:42 pm
Thanks a ton I will research tomarrow after work. My head hurts after reading Sociology topics.   smiley-sleep
20  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 19, 2012, 10:35:06 pm
James,

   Yes I suppose that is what I was trying! Am I far off on this?

Lance
21  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 19, 2012, 08:20:35 pm
James,

    I purchased about five ATmega328's that has a blank bootloader. Then I wanted to avoid pulling the arduino's ATmega out to program the chips 1-5. Figured I would create this shield to burn the bootloader as well as burn the program I wanted to use that chip(1-5) for. I.E. the 4x4 cube present, or the relay box I have. I guess what I have created is JUST the bootloader shield NOT a full on programming shield.

Lance
22  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 19, 2012, 01:24:00 pm
Aweseom thanks Bill! (S1 goes from analog 1 of the host board to ground.)

So on the latter part of what you just said......

"The only code the standalone bootloader sketch delivers is a modified version of the optiboot bootloader (adaboot) as per Limor's blog:

"The standalone sketch will only program ATmega328P chips and it will program them with our "adaBoot" Bootloader not Optiboot! Select Duemilanove with 328 when uploading to Arduinos that use the bootloaded chip, even if you are using it in an UNO branded Arduino! "

That code is contained within the sketch itself."


CRAP! Did I just waste 5 bucks and a couple hours of my time?! What I wanted to do was build a rig so I can program the chips in order to transfer them to run standalone.
23  Using Arduino / General Electronics / Re: Activating a 220V AC device using Arduino? on: November 19, 2012, 08:08:51 am
Hey I am  currently in the final stages of my design activating two 115VAC fans using the Arduino. I am using just a simple relay. If your interested I can show you what/how it works.

Lance
24  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 19, 2012, 08:04:38 am
Ok so any ideas where to wire to and from for S1? Also I understand i am telling the Arduino to burn a new program into the 2nd chip with this code but any idea where I place the code to be burned?

25  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 17, 2012, 10:44:00 pm
Ok I grabbed a beer and regained my thoughts. I have the LED's hooked up correctly now and am using the power rail which cleaned things up a bit. Now my last question!


- What is the purpose of S1 and how do I connect it to my board? It says to: "Next add S1switch which you will press to start the programming process. You can just solder a wire (yellow) from the breakout near S1 to Analog 1" but what does that do with only one wire going from A1 to the switch?

Thanks!!
26  Using Arduino / General Electronics / Re: Need help populating Arduino r3 proto shield. on: November 17, 2012, 08:51:42 pm
James,

    Let me try to clarify. I am not sure how to wire up the switch and leds actually.  smiley-eek I am a hands on learner so wrapping my noggin around the picture has me scared to mis-wire something. Figured it was better to ask then waste cash/time.

    I will post a photo of my board from underneath. I connected the pins the adafruit board said to. IE. pin 9 to pin 9 on chip.

Thanks again for the help. Can't wait to get this thing going! I have a relay setup ready to be standalone and a 4x4 led cube for an xmas present ready to go.

Lance
27  Using Arduino / General Electronics / Need help populating Arduino r3 proto shield. on: November 17, 2012, 10:53:24 am
I am in the process of populating the shield following http://ladyada.net/library/tools/standaloneisp.html  but they have a different proto board. Where do I connect the reset switch and leds on this board?

My board - [url]http://www.mouser.com/ProductDetail/Arduino/A000082/?qs=sGAEpiMZZMtE4ePzUE8d2CmN5d6cQSeK[/url

Thanks guys
28  Using Arduino / Programming Questions / Re: Some errors in this code. Requesting help. on: October 25, 2012, 09:35:31 pm
OK so I have spent 6 hours sitting here trying to get this thing to work... I have gotten the above code to work....kinda. It jitters and sort of tracks a color but even the shadow from the light throws it off.

I need to start from scratch but don't know how!

Ultimate goal is to get my animatronic eye setup to track "a blob" or change in scenery so as to have my Halloween prop look at and follow the children.

I know its fairly straight forward but like most tutorials they expect you to understand how all aspects work.

So will anyone guide me in this matter?

So far I have set up:

Two servos controlling the eyes:

   Servo for X movement - pin 8

   Servo for Y movement - pin 9

   COM Port 3

   USB Camera

   Processing is installed and working.

   OpenCV I don't think is working correct.


Thats where my knowledge ends and I am frustrated! smiley-sad-blue

29  Using Arduino / Programming Questions / Re: Some errors in this code. Requesting help. on: October 25, 2012, 01:07:32 pm
Paul and Peter,


Sorry let me clarify. My error is coming from processing.

Paul,

  Holy crap man this is chinese! I took one class in Java and got by in the skin of my teeth!

Maybe I am going about this the wrong way but I figured it would be pretty easy to get the video camera to track a blob or face and send the outputs to the x and y servos (the eyes in my prop).

Lance  smiley-eek-blue
30  Using Arduino / Programming Questions / Some errors in this code. Requesting help. on: October 25, 2012, 11:09:30 am
Overall goal:

    Use processing to control two servos for eye movement via a webcam.

I borrowed the code from somewhere on this forum but I am having issues naturally.

Arduino code:

Code:
#include <Servo.h>

Servo neck;
Servo neck2;

int xPos=0;
int yPos = 0;

void setup()  {
  Serial.begin(9600);
  neck.attach(9);
  neck.attach(10);
}

void loop()  {
  if(Serial.available() >0)  {
    xPos=Serial.read();
    yPos=Serial.read();
  }
  int xServo = map(xPos, 0, 320, 20, 70);
  int yServo = map(yPos, 0, 240, 20, 70);
  neck.write(xServo);
  neck2.write(yServo);
}

Processing Code:

Code:
import processing.serial.*;

// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 16-11: Simple color tracking

import processing.video.*;

// Variable for capture device
Capture video;
Serial arduino;

// A variable for the color we are searching for.
color trackColor;
boolean clicked;

void setup() {
  size(400,400);
  String portName = Serial.list()[0];
  arduino = new Serial(this, portName, 9600);
  video = new Capture(this,width,height,15);
  // Start off tracking for red
  trackColor = color(0,0,255);
  smooth();
}

void draw() {
  // Capture and display the video
  if (video.available()) {
    video.read();
  }
  video.loadPixels();
  image(video,0,0);

  // Before we begin searching, the "world record" for closest color is set to a high number that is easy for the first pixel to beat.
  float worldRecord = 500;

  // XY coordinate of closest color
  int closestX = 0;
  int closestY = 0;

  // Begin loop to walk through every pixel
  for (int x = 0; x < video.width; x ++ ) {
    for (int y = 0; y < video.height; y ++ ) {
      int loc = x + y*video.width;
      // What is current color
      color currentColor = video.pixels[loc];
      float r1 = red(currentColor);
      float g1 = green(currentColor);
      float b1 = blue(currentColor);
      float r2 = red(trackColor);
      float g2 = green(trackColor);
      float b2 = blue(trackColor);

      // Using euclidean distance to compare colors
      float d = dist(r1,g1,b1,r2,g2,b2); // We are using the dist( ) function to compare the current color with the color we are tracking.

      // If current color is more similar to tracked color than
      // closest color, save current location and current difference
      if (d < worldRecord) {
        worldRecord = d;
        closestX = x;
        closestY = y;
      }
    }
  }

  // We only consider the color found if its color distance is less than 10.
  // This threshold of 10 is arbitrary and you can adjust this number depending on how accurate you require the tracking to be.
  if (worldRecord < 10) {
    fill(trackColor);
    strokeWeight(4.0);
    stroke(0);
    ellipse(closestX,closestY,10,10);
    arduino.write(closestX);
    arduino.write(closestY);
    println(closestX);
println(closestY);

  }
 
}

void mousePressed() {

  // Save color where the mouse is clicked in trackColor variable
  int loc = mouseX + mouseY*video.width;
  trackColor = video.pixels[loc];
}


My error is:

ArrayIndexOutOfBoundsException: 0

Code:
void setup() {
  size(400,400);
  [glow=yellow,2,300]String portName = Serial.list()[0];
  arduino = new Serial(this, portName, 9600);[/glow]
  video = new Capture(this,width,height,15);
  // Start off tracking for red
  trackColor = color(0,0,255);
  smooth();
}
Pages: 1 [2] 3