Show Posts
Pages: 1 ... 21 22 [23] 24 25 ... 49
331  Using Arduino / LEDs and Multiplexing / Re: Fade all and light on: April 11, 2013, 10:31:24 am
It depends on what board you have.  But, I changed the code to NOT light 4 pins.  Those 4 pins you will have to find during testing because I don't know what board you have.

Code:
// Fade all IO by Osamu Iwasaki
// November 10, 2010

#include <MsTimer2.h>

#define OUT_MIN 4  // First pin
#define OUT_MAX 19  // Last pin (this includes the analog pins)

byte luminance[20];
byte lumi[20] = {};

void setup()
{
 int i;

 for(i = OUT_MIN; i <= OUT_MAX; i++){
   pinMode(i, OUTPUT);
   digitalWrite(i,LOW);
 }


 for(i = OUT_MIN; i <= OUT_MAX; i++){
   digitalWrite(i,HIGH);
   delay(150);
 }
 for(i = OUT_MIN; i <= OUT_MAX; i++){
   digitalWrite(i,LOW);
   //delay(50);
 }
 delay(1000);

 MsTimer2::set(1, int_pwm);
 MsTimer2::start();
}


void int_pwm() {

 static int f_wait[20];
 static int f_max_time[20];
 static int f_speed[20];
 static int f_ct[20];
 static long f_interval[20];

 static int ch;

 for(ch = OUT_MIN; ch <= OUT_MAX; ch++){
   if(f_wait[ch] == 0){
     f_wait[ch] = f_speed[ch] + 1;

     if( (f_ct[ch] < 255) )
       if(luminance[ch] != 255)
         luminance[ch] ++;

     if(f_ct[ch] == 255){
       if(f_max_time[ch] == 0)
         f_max_time[ch] = 0; // On Max Time
       else
         f_max_time[ch] --;
     }

     if( (f_ct[ch] > 255) && (f_ct[ch] < 511) && (f_max_time[ch] == 0))
       if(luminance[ch] != 0)
         luminance[ch] --;

     if(f_ct[ch] >= 511){
       if(f_interval[ch] == 0){
         f_interval[ch] = 10 * random(100); // fading seed
         f_speed[ch] = random(100); // fading speed
         f_ct[ch] = 0;
       }
       else
         f_interval[ch] --;
     }
     else
       f_ct[ch] ++;
   }
   f_wait[ch] --;
 }
}

void fading(){

 static byte counter = 0;
 static boolean prev_off[20];
 int i;

 for(i = OUT_MIN; i <= OUT_MAX; i++){
   if(lumi[i] == 0){
     if(prev_off[i] == HIGH){
       digitalWrite(i,LOW);
       prev_off[i] = LOW;
     }
   }
   else
     lumi[i] --;
 }

 counter --;

 if(counter == 0){
   for(i = OUT_MIN; i <= OUT_MAX; i++){
     if(luminance[i]){
       digitalWrite(i,HIGH);
       prev_off[i] = HIGH;
     }
     lumi[i] = luminance[i];
   }
 }
}


void loop(){
 fading();
}
332  Using Arduino / LEDs and Multiplexing / Re: Need help: 2 TLC5940 Arduino problem on: April 11, 2013, 10:25:21 am
It's hard to say without seeing your setup.  Take a pic and post it.  If you don't have decoupling caps, that could be your problem (which I think it is).
333  Using Arduino / General Electronics / Re: Resistor identification on: April 11, 2013, 10:12:10 am
It looks that way. 
334  Using Arduino / General Electronics / Re: Cooked PCB on: April 11, 2013, 10:07:52 am
It's hard to say how/what/where to connect anything if we don't know what the specs are on your motor.  Try finding a number on the motor and looking it up.  It should tell you how to hook it up.

Even if it's small, it could be a 12V, hell even a 24V motor...
335  Using Arduino / General Electronics / Re: Arduino with Vex Spike on: April 10, 2013, 11:20:26 am
The user guide listed on the product page has the information you need to connect it and what the Vex needs to work (turn the motor).  All you have to do is connect ground and 2 wires to the arduino (any pin), then program the arduino to make a wire go HIGH for forward and the other HIGH (make the other one LOW) to make it go in reverse. 
336  Using Arduino / General Electronics / Re: Arduino with Vex Spike on: April 10, 2013, 10:38:04 am
Have you hooked up the 3 wires that go to the Microcontroller?  Have you read the user guide?
337  Using Arduino / LEDs and Multiplexing / Re: My RGB LED Stairs Illumination video on: April 09, 2013, 07:00:43 pm
Thanks funky, I will take a look at it.  I haven't received my boards yet.  For some reason, OSH is taken it's time...

+1
338  Using Arduino / Programming Questions / Re: Overriding Library Files from Sketch Folder on: April 08, 2013, 06:17:42 pm
You can rename your modified files.
339  Using Arduino / Programming Questions / Re: BitVoicer Code is NOT Working with me :' on: April 08, 2013, 03:41:05 pm
Use this code.  From the discussion here - http://arduino.cc/forum/index.php/topic,140766.msg1072337.html#msg1072337;

Code:
#include <BitVoicer11.h>

//Instantiates the BitVoicerSerial class
BitVoicerSerial bvSerial = BitVoicerSerial();

//Stores true if the Audio Streaming Calibration tool
//is running
boolean sampleTest = false;
//Stores the data type retrieved by getData()
byte dataType = 0;
//Sets up the pins and default variables
int pinR = 3;
int pinY = 5;
int pinG = 6;
int lightLevel = 0;

void setup()
{
  //Sets the analog reference to external (AREF pin)
  //WARNING!!! If anything is conected to the AREF pin,
  //this function MUST be called first. Otherwise, it will
  //damage the board.
  bvSerial.setAnalogReference(BV_EXTERNAL);
  //Sets up the microcontroller to perform faster analog reads
  //on the specified pin
  bvSerial.setAudioInput(0);
  //Starts serial communication at 115200 bps
  Serial.begin(115200);
  //Sets up the pinModes
  pinMode(pinR, OUTPUT);
  pinMode(pinY, OUTPUT);
  pinMode(pinG, OUTPUT);
}

void loop()
{
  //Captures audio and sends it to BitVoicer if the Audio
  //Streaming Calibration Tool is running
  if (sampleTest == true)
  {
    //The value passed to the function is the time
    //(in microseconds) that the function has to wait before
    //performing the reading. It is used to achieve about
    //8000 readings per second.
    bvSerial.processAudio(46);
  }
 
  //Captures audio and sends it to BitVoicer if the Speech
  //Recognition Engine is running
  if (bvSerial.engineRunning)
  {
    //The value passed to the function is the time
    //(in microseconds) that the function has to wait before
    //performing the reading. It is used to achieve about
    //8000 readings per second.
    bvSerial.processAudio(46);
  }
}

//This function runs every time serial data is available
//in the serial buffer after a loop
void serialEvent()
{
  //Reads the serial buffer and stores the received data type
  dataType = bvSerial.getData();
 
  //Changes the value of sampleTest if the received data was
  //the start/stop sampling command
  if (dataType == BV_COMMAND)
      sampleTest = bvSerial.cmdData;
 
  //Signals BitVoicer's Speech Recognition Engine to start
  //listening to audio streams after the engineRunning status
  //was received
  if (dataType == BV_STATUS && bvSerial.engineRunning == true)
    bvSerial.startStopListening();
 
  //Checks if the data type is the same as the one in the
  //Voice Schema
  if (dataType == BV_STR)
    setLEDs();
}

//Performs the LED changes according to the value in
//bvSerial.strData
void setLEDs()
{
  if (bvSerial.strData == "wake")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "sleep")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "RH")
  {
    digitalWrite(pinR, HIGH);
    lightLevel = 255;
  }
  else if (bvSerial.strData == "RL")
  {
    digitalWrite(pinR, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "YH")
  {
    digitalWrite(pinY, HIGH);
    lightLevel = 255;
  }
  else if (bvSerial.strData == "YL")
  {
    digitalWrite(pinY, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "GH")
  {
    digitalWrite(pinG, HIGH);
    lightLevel = 255;
  }
  else if (bvSerial.strData == "GL")
  {
    digitalWrite(pinG, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "ALLON")
  {
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    lightLevel = 255;
  }
  else if (bvSerial.strData == "ALLOFF")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    lightLevel = 0;
  }
  else if (bvSerial.strData == "brighter")
  {
    if (lightLevel < 255)
    {
      lightLevel += 85;
      analogWrite(pinR, lightLevel);
      analogWrite(pinY, lightLevel);
      analogWrite(pinG, lightLevel);
    }
  }
  else if (bvSerial.strData == "darker")
  {
    if (lightLevel > 0)
    {
      lightLevel -= 85;
      analogWrite(pinR, lightLevel);
      analogWrite(pinY, lightLevel);
      analogWrite(pinG, lightLevel);
    }
  }
  else
  {
    bvSerial.startStopListening();
    bvSerial.sendToBV("ERROR:" + bvSerial.strData);
    bvSerial.startStopListening();
  }
}

340  Using Arduino / Programming Questions / Re: Pololu DRV8825 driver problem on: April 08, 2013, 03:31:15 pm
Perhaps if you posted a picture of how you really have the board connected to the Arduino, motors, and batteries/power supply, we could help.

@ ifug: Why can't you put spaces before links?
341  Using Arduino / General Electronics / Re: Minimalist 2560 pcb design on: April 08, 2013, 05:49:35 am
If you post an image rather than an eagle file then more people will be able to look at your schematic...  I've got Eagle but an older version
so I can't see it either!

I don't know why you would want to see mine..  But ok.

342  Using Arduino / General Electronics / Re: Minimalist 2560 pcb design on: April 07, 2013, 08:58:54 pm
Sure, just make sure you have something that will reset the 2560.
343  Using Arduino / General Electronics / Re: Minimalist 2560 pcb design on: April 07, 2013, 08:14:00 pm
There's actually lots of ways to get that error.  Attach your sch and brd files and I will have a look.

Ok, cool..
344  Using Arduino / General Electronics / Re: Minimalist 2560 pcb design on: April 07, 2013, 07:34:46 pm
Delete the Nets and try it again.  I have had the problem where the Nets look connected on the schematic but not connected on the PCB.  I have to delete the Nets and re-draw them.  Somehow, they're really not connected..

Oh, and make sure that both Nets that you want connected have the same name..
345  Using Arduino / Programming Questions / Re: Arduino pro mini 328 - MultiWii1_8 on: April 07, 2013, 03:28:20 pm
What language do you speak?  You could post this in your language in the respective forum.

I am having a hard time understanding..
Pages: 1 ... 21 22 [23] 24 25 ... 49