Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Networking, Protocols, and Devices / Re: Wireless Range and bps on: December 29, 2011, 10:10:21 pm
As you put more data into the modulation your Signal to Noise margin needs to be higher to pull the data back out with out errors.
32  Using Arduino / Motors, Mechanics, and Power / Re: l293d problem on: December 29, 2011, 08:32:18 pm
the official rev 3 board does that (different chip)
http://mcukits.com/2009/03/12/assembling-the-freeduino-arduino-motor-shield/ does also

I looked at the spec sheet and it looks like an acceptable thing to do
33  Using Arduino / Sensors / Re: Interfacing TMP006 with Arduino Uno on: December 29, 2011, 06:50:47 pm
sorry, after looking at the spec sheet closer it uses I²C (arduino library: http://www.arduino.cc/en/Reference/Wire) not SPI

Datasheet
Quote from: page 13
SERIAL INTERFACE
The TMP006 operates only as a slave device on either the two-wire bus or the SMBus interface. Connections to either bus are made via the open-drain I/O lines, SDA, and SCL. The SDA and SCL pins feature integrated spike-suppression filters and Schmitt triggers to minimize the effects of input spikes and bus noise. The TMP006 supports the transmission protocol for fast (1 kHz to 400 kHz) and high-speed (1 kHz to 3.4 MHz) modes. All data bytes are transmitted MSB first
34  Using Arduino / Sensors / Re: Interfacing TMP006 with Arduino Uno on: December 29, 2011, 05:27:25 pm
it looks like this library would handle the communication with the sensor: http://arduino.cc/en/Reference/SPI
You would need to verify on the data sheet the fine details.
35  Using Arduino / Networking, Protocols, and Devices / Re: xbee controlling LEDs on: December 29, 2011, 12:18:33 pm
you need to mix your "turn on" and "turn off" code into one serial read statement, otherwise they will prevent each other from getting valid data from the serial interface.
36  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Client Issue with 1and1.co.uk on: December 28, 2011, 10:36:55 pm
looks like the server has it as Index.html not index.html - the part of the URL after the hostname/ is case sensitive.  The response from the server is giving you the URL to request to get the page..
37  Using Arduino / Installation & Troubleshooting / Re: Cannot upload sketch to arduino from Windows7 on: December 28, 2011, 10:18:10 pm
check what com port you have selected, the arduino most likely didn't enumerate at com1 that your error message shows the IDE trying to use.
38  Using Arduino / Networking, Protocols, and Devices / Re: xbee controlling LEDs on: December 28, 2011, 08:05:42 pm
I had a moment and came up with this
I haven't worked with the xbee so am assuming that it works like normal serial interface as you seem to be enabling it as such, but if there is something special on how to use it, you may need to adjust this code.

If someone else could look at my logic to make sure this works, it compiles, but I haven't tested the code on a board.

Code:
// array to hold LED pin numbers
int myLED[] = {11, 12, 13};  
//array to hold codes for signaling
int myLEDCode[] = {'A', 'B', 'C'};
// int to record number of LEDs
int numLED = 3;
// track when LED was last enabled
unsigned long previousLEDOnMillis[] = {0, 0, 0};

//track when last LED update was sent to other board
unsigned long previousUpdateMillis[] = {0, 0, 0};

// array to hold switch pin numbers
int mySwitch[] = {5, 6, 7};
//assuming number of switches matches number of LEDs so reusing that variable

//variable to track current millis value for current loop
unsigned long currentMillis;

// update send interval
unsigned int updateInterval = 10;

// LED on time interval
unsigned int ledInterval = 15;

void setup () {
  // Set LED pins to output
  for( int i = 0; i < numLED; i++) {
    pinMode(myLED[i], OUTPUT);
  }
  // Set switch pins to inputs
  for( int i = 0; i < numLED; i++) {
    pinMode(mySwitch[i], INPUT);
  }
  // start up serial
  Serial.begin(9600);      
}

void loop(){
  // set current millis for loop
  currentMillis = millis();
  
  while (Serial.available() > 0) {
    // load character in to temp variable
    int inByte = Serial.read();
    
    // loop to set previousLEDOnTime for coresponding LED
    for( int i = 0; i < numLED; i++){
      if( inByte == myLEDCode[i]){
        //set previousLEDOnTime so we know when to turn LED on, and turn LED on
        previousLEDOnMillis[i] = currentMillis;
        digitalWrite(myLED[i], HIGH);
      }
    }
  }

  //loop to check for button presses
  for( int i = 0; i < numLED; i++){
    if (digitalRead(mySwitch[i]) == HIGH){
      // update other board, set last update time if we haven't in last 10 ms
      if (currentMillis - previousUpdateMillis[i] >= updateInterval){
        Serial.print(myLEDCode[i]);
        previousUpdateMillis[i] = currentMillis;
      }
      // set LED off time and enable port
      previousLEDOnMillis[i] = currentMillis;
      digitalWrite(myLED[i], HIGH);
    }
  }
  
  //loop to check if an LED pin needs to be turned off
   for( int i = 0; i < numLED; i++){
     if (currentMillis - previousLEDOnMillis[i] >= ledInterval){
       // it has been more then ledInterval since pin was last signaled to be on
       digitalWrite(myLED[i], LOW);
     }
   }

}
39  Using Arduino / Networking, Protocols, and Devices / Re: xbee controlling LEDs on: December 28, 2011, 07:08:01 pm
you are sending the update pulses at most every 20 ms (+ 20 ms per LED switch on) but only turning them on for 10 ms if you receive the "on" signal.

You might want to look at the flashing with out delay example so you can do 2 things at once.

It looks like your serial interface can transmit around 960 characters per second & 3 LEDs.

I would do this -> send your on pulses at 10 ms intervals, but display the light for 15 ms after receiving the pulse.

that would give you 5 ms over lap allowing a constant on signal.

let me know if you want more specific code.
40  Using Arduino / Motors, Mechanics, and Power / Re: Ardumoto motor driver shield overclocking on: December 23, 2011, 09:23:33 am
it will either overhead/melt/break or if it has over current/heat protection, that will kick in.
41  Using Arduino / Programming Questions / Re: Best Practice with millis()? on: December 23, 2011, 09:19:36 am
thank you.
42  Using Arduino / Programming Questions / Best Practice with millis()? on: December 23, 2011, 08:37:54 am
I have seen code examples using millis 2 different ways and was wondering if one of these is better then the other.

Method 1:
Code:
unsigned long previousMillis = 0;     
unsigned long interval = 1000;     

void setup() {
  // setup code here     
}

void loop()
{
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   
    // do something
   
  }
}

Method 2:
Code:
unsigned long previousMillis = 0;     
unsigned long interval = 1000;     

void setup() {
  // setup code here     
}

void loop()
{
  unsigned long currentMillis = millis();
 
  if(currentMillis > nextMillis) {
    nextMillis = currentMillis + interval;   
    // do something
   
  }
}

Method 2 only does the addition/subtraction one time so it would save some cycles every time through the loop, however it looks like it will have issues when the unsigned long rolls over (approximately 50 days).

does Method 1 get around the bound condition when the millis rolls over or is there any other reason to do the code that way instead of method 2?
43  Topics / Robotics / Re: RC-Car Control on: December 23, 2011, 07:55:49 am
If you want the car to stop if it doesn't receive any input, you should add some code on the Arduino to detect the lack of input -> something like this:

// global variable declarations
unsigned long previousMillis = 0;
unsigned long interval = 100;  // 1/10 second

at the begining of your loop add
unsigned long currentMillis = Millis();

after
if (Serial.available() > 0)
{
  buffer=Serial.read()
add this
  previousMillis = currentMillis;


then after the if statement closes

if(currentMillis - previousMillis > interval) {
   //code to stop the car
}

this will cause the car to stop if it doesn't receive input for interval ms
44  Using Arduino / Programming Questions / Re: Line Following Robot Help .. on: December 22, 2011, 02:55:53 pm
after copying your code and clicking verify I was informed of the following errors:

a missing ), an extra {, and a missing }

After correcting the errors found by clicking verify, the code compiled, however as I don't have a circuit diagram, etc for your robot, I do not know if this will do as you are expecting.

for example what happens if all the senors are low or high?
45  Topics / Robotics / Re: Are these components compatible? (chassis/motorshield related) on: December 22, 2011, 01:41:35 pm
the adafriut only handles 600 mA per channel doubling that only gives 1200 mA which is still well below 2800 mA.

You need a driver that can do 4 channels of 2800 mA or higher draw or 2 channels of 5600 mA or higher draw.
Pages: 1 2 [3] 4