Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Robot Programming Question on: December 04, 2011, 05:47:05 pm
Thanks AWOL!  I changed the "=" to a "==" and that solved the problem.
2  Using Arduino / Programming Questions / Robot Programming Question on: December 04, 2011, 05:39:31 pm
 I am programming a simple robot to go when a button is pressed, and to stop if it isn't.  I am using a nunchuck as the button.  The code is pretty self explanatory; the digitalWrite commands set the direction of the motor to forward, and the analogWrite commands set the power of the motor.  When I upload the code, the motors run at full speed, even if the if statement isn't true.  I have no idea what's going on here!  Any ideas?
Code:
int y;
int x = 0;
int b;

#include <Wire.h>
#include "nunchuck_funcs.h"


void setup()
{
    Serial.begin(19200);
    nunchuck_setpowerpins();
    nunchuck_init();
    pinMode(3, OUTPUT);  //Set control pins to be outputs
    pinMode(11, OUTPUT);
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);
}

void loop()
{
        b = 0;
        nunchuck_get_data();
        b = nunchuck_zbutton();
        Serial.println(b);
       
        if (b = 1) {
          digitalWrite(12, HIGH);
          digitalWrite(13,HIGH);
          analogWrite(3, 255);  //set both motors to run at 100% duty cycle (fast)
          analogWrite(11, 255);
        }
        if (b = 0) {
          digitalWrite(12, HIGH);
          digitalWrite(13,HIGH);
          analogWrite(3, 0);  //set both motors to run at 100% duty cycle (fast)
          analogWrite(11, 0);
        }
        else {
        }
       
}
3  Using Arduino / General Electronics / Photo Sensors on: August 15, 2011, 07:56:55 pm
I was looking to build a laser chronograph, and I was looking for two photosensors to use.  When the projectile breaks one of them, it starts a timer, and when it breaks the second, it stops the timer.  I could use analogRead() to read a photoresistor, but that would take up too much time in my loop.  Is there any way I can configure an optical sensor to just get a digital reading, a LOW or HIGH, depending on if the beam is broken?
4  Using Arduino / Installation & Troubleshooting / Arduino IDE Error on: June 01, 2011, 09:29:38 am
I am trying to use a Duemilanove on Windows 7.  I am using one of the example sketches that comes with the program.  Whenever I try to upload I get this error:


Binary sketch size: 1978 bytes (of a 30720 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I have uploaded to this board in the past.  It usually works flawlessly.  But the serial port of the board is COM1, which is always available even if the board is disconnected.  This may signal a driver issue.  The is nothing connected to the board, and I have tried two different boards of the same model.  Please help!!!


5  Using Arduino / Project Guidance / Laser timing on: March 10, 2011, 03:30:33 pm
I was going to build a system that times a projectile using lasers.  Two beams are placed a foot apart
and the arduino measures the time between each beam. 
Here is my question.  How quick can the arduino respond?  Can it catch the 2 ms time difference
of a 500 ft/s projectile?
6  Forum 2005-2010 (read only) / Exhibition / Re: Arduino + Lego NXT on: December 30, 2010, 04:12:26 pm
How did you connect the NXT servos to the Arduino?  I've been looking for a pinout of the NXT parts.
Pages: [1]