Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / 16x16 LED Matrix on: April 09, 2013, 11:00:23 pm
I purchased (hasn't arrived) a 16 x 16 matrix from http://www.emartee.com/Modules/bbs/frame.php?frameon=yes&referer=http%3A//www.emartee.com/Modules/bbs/viewthread.php%3Ftid%3D711%26extra%3Dpage%253D1 and I want to have it display an array which will later be programmed, but right now is static. However, I am not sure if the following code will work. Can someone proof read it.

Thanks

Code:
    int myArray[16*16] = {1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
              1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0}; //16x16 array;
   
    int A_port = 4;
    int B_port = 5;
    int C_port = 6;
    int D_port = 7;
   
    int OOE=2;
    int RCK=10;
    int SCKPin=9; //SCK is already defined as 13.
    int SER=8;
    int VCC=11;
    int GND=3;

void setup() {
   pinMode(2,OUTPUT);
   pinMode(3,OUTPUT);
   pinMode(4,OUTPUT);
   pinMode(5,OUTPUT);
   pinMode(6,OUTPUT);
   pinMode(7,OUTPUT);
   pinMode(8,OUTPUT);
   pinMode(9,OUTPUT);
   pinMode(10,OUTPUT);
   pinMode(11,OUTPUT);
   
   Serial.begin(9600);
   digitalWrite(OOE,HIGH);
   digitalWrite(VCC,HIGH);
   digitalWrite(GND,LOW);
   digitalWrite(SCKPin,LOW);
}

void loop() {

   
       for(int disrow=0;disrow<16;disrow++)            //scanning the row
       {
         digitalWrite(OOE,HIGH);
         digitalWrite(RCK,LOW);
         //loadoneline();                              //load the data of a row
         //sendoneline();                              //send the data of a row
         //sendPin(disrow);
         
         //SelectRow
         lightArray(disrow);
               
         digitalWrite(OOE,LOW);                     // enable the row scanning
         digitalWrite(RCK,HIGH);                    //light a row
         delay(1);
       }
   
 
 
}

void lightArray(int row)
{
  //Light the row
 
  Serial.print("Row: ");
  Serial.print(row);
  Serial.print(" ");
 
  switch (row){
case 0:
digitalWrite(A_port , 0); digitalWrite(B_port , 0); digitalWrite(C_port,  0); digitalWrite(D_port , 0);
break;
case 1:
digitalWrite(A_port , 1); digitalWrite(B_port , 0); digitalWrite(C_port,  0); digitalWrite(D_port , 0);
break;
case 2:
digitalWrite(A_port , 0); digitalWrite(B_port , 1); digitalWrite(C_port,  0); digitalWrite(D_port , 0);
break;
case 3:
digitalWrite(A_port , 1); digitalWrite(B_port , 1); digitalWrite(C_port,  0); digitalWrite(D_port , 0);
break;
case 4:
digitalWrite(A_port , 0); digitalWrite(B_port , 0); digitalWrite(C_port,  1); digitalWrite(D_port , 0);
break;
case 5:
digitalWrite(A_port , 1); digitalWrite(B_port , 0); digitalWrite(C_port,  1); digitalWrite(D_port , 0);
break;
case 6:
digitalWrite(A_port , 0); digitalWrite(B_port , 1); digitalWrite(C_port,  1); digitalWrite(D_port , 0);
break;
case 7:
digitalWrite(A_port , 1); digitalWrite(B_port , 1); digitalWrite(C_port,  1); digitalWrite(D_port , 0);
break;
case 8:
digitalWrite(A_port , 0); digitalWrite(B_port , 0); digitalWrite(C_port,  0); digitalWrite(D_port , 1);
break;
case 9:
digitalWrite(A_port , 1); digitalWrite(B_port , 0); digitalWrite(C_port,  0); digitalWrite(D_port , 1);
break;
case 10:
digitalWrite(A_port , 0); digitalWrite(B_port , 1); digitalWrite(C_port,  0); digitalWrite(D_port , 1);
break;
case 11:
digitalWrite(A_port , 1); digitalWrite(B_port , 1); digitalWrite(C_port,  0); digitalWrite(D_port , 1);
break;
case 12:
digitalWrite(A_port , 0); digitalWrite(B_port , 0); digitalWrite(C_port,  1); digitalWrite(D_port , 1);
break;
case 13:
digitalWrite(A_port , 1); digitalWrite(B_port , 0); digitalWrite(C_port,  1); digitalWrite(D_port , 1);
break;
case 14:
digitalWrite(A_port , 0); digitalWrite(B_port , 1); digitalWrite(C_port,  1); digitalWrite(D_port , 1);
break;
case 15:
digitalWrite(A_port , 1); digitalWrite(B_port , 1); digitalWrite(C_port,  1); digitalWrite(D_port , 1);
break;
}
 
  //Light the columns
 
  for(int i = 0; i<numShifters;i++)
  {
  digitalWrite(RCLK_Pin,LOW);
  for (int n=0;n<8*numShifters;n++)
   {
      digitalWrite(SRCLK_Pin,LOW);
      if(myArray[row*n] == 1)
      {
        digitalWrite(SER_Pin,LOW);
        Serial.print("H ");
      }
      else
      {
        digitalWrite(SER,HIGH);
        Serial.print("L ");
      }
      //j=j>>1; //bitshift
      digitalWrite(SRCLK_Pin,HIGH);
                //delay(1);
   }
   digitalWrite(RCLK_Pin,HIGH);
  }
 
 Serial.println(); 
}

2  Using Arduino / Motors, Mechanics, and Power / Re: Big Easy Driver - Smooth Motion for a Sec then gets jumpy. on: April 05, 2012, 04:30:32 pm
Adjusting the circuit amp cut off fixed all problems.

This also reduced the heat of the motors dramatically.
3  Using Arduino / Motors, Mechanics, and Power / Re: Big Easy Driver - Steppers Emitting Hum on: April 05, 2012, 04:29:59 pm
Adjusting the circuit amp cut off fixed both.

This also reduced the heat of the motors dramatically.
4  Using Arduino / Motors, Mechanics, and Power / Re: Big Easy Driver - Smooth Motion for a Sec then gets jumpy. on: April 05, 2012, 01:30:58 pm
I think it had to do with the amp adjustment. Ill keep yall informed.
5  Using Arduino / Motors, Mechanics, and Power / Big Easy Driver - Smooth Motion for a Sec then gets jumpy. on: April 05, 2012, 01:15:27 pm
This happens with basically any code I use. Here is an example of one where it runs smoothly for a bit then gets really jerky and jumpy.

Code:
#include <Stepper.h>

// Define a stepper and the pins it will use
Stepper stepper1(200*8, 6, 7);


int count1 = 0;


void setup()

 

   stepper1.setSpeed(15);
}

void loop()
{

  stepper1.step(5);
}
6  Using Arduino / Motors, Mechanics, and Power / Re: Big Easy Driver - Steppers Emitting Hum on: April 05, 2012, 12:58:10 pm
Okay. I have a more pressing issue with the stepper motor. I am using 1/8 steps on the big easy driver. Its smooth for a bit then gets jumpy. Why is that?

Here is the code

Code:
#include <AccelStepper.h>

// Define a stepper and the pins it will use

AccelStepper stepper1(1, 6, 7);


int count1 = 0;


void setup()


   stepper1.setMaxSpeed(500.0);
   stepper1.setAcceleration(5000.0);
   stepper1.moveTo(800);
}

void loop()
{

 // Change direction at the limits
    if (stepper1.distanceToGo() == 0)
   stepper1.moveTo(-stepper1.currentPosition());
  stepper1.run();
}
7  Using Arduino / Motors, Mechanics, and Power / Re: Big Easy Driver - Steppers Emitting Hum on: April 05, 2012, 12:06:23 pm
I have an external 12V 10Amp power supply which powers two steppers and 2 drivers. They can handle 2 Amps. Here are the links to both devices.

http://www.sparkfun.com/products/10847

http://www.sparkfun.com/products/10735
8  Using Arduino / Motors, Mechanics, and Power / Big Easy Driver - Steppers Emitting Hum on: April 05, 2012, 01:57:41 am
I've got two steppers motors working pretty good but when they are plugged in you can hear an annoying whine or hum.

How can I fix this.

Thanks.
9  Using Arduino / Motors, Mechanics, and Power / Re: ROB-10847 DC Stepper Motor with EasyDriver Shield on: March 26, 2012, 06:03:57 pm
I see that the motor wants 3V at a max of 2 amps but the Shield doesn't want a voltage that low to drive it. Is there a different shield that I could use.
10  Using Arduino / Motors, Mechanics, and Power / ROB-10847 DC Stepper Motor with EasyDriver Shield on: March 26, 2012, 03:56:23 pm
I want to use the following stepper motor: http://www.sparkfun.com/products/10847
and the following shield: http://www.sparkfun.com/products/10267

I would like to use a 12V power supply as well.

A simple tutorial, http://bildr.org/2011/06/easydriver/



How would I hook up my stepper motor??

Thanks.
11  Using Arduino / Installation & Troubleshooting / Measuring Frequency on Arduino Mega 2560 on: June 04, 2011, 07:56:41 pm
This was very difficult to find.

To do this you need to download the library at ... http://www.pjrc.com/teensy/td_libs_FreqCount.html

Pin 47 is used to measure the frequency on the 2560 mega and cannot be changed. Here is sample code that will work with the arduino.

Code:
/* FreqCount - Example with serial output
* NEED TO USE D IO PIN 47 FOR FREQUENCY INPUT FOR 2560 MEGA!!!!!!!!
 * http://www.pjrc.com/teensy/td_libs_FreqCount.html
 *
 * This example code is in the public domain.
 */
#include <FreqCount.h>

void setup() { 
  Serial.begin(9600);
  FreqCount.begin(1000);
}

void loop() {
  if (FreqCount.available()) {
    unsigned long count = FreqCount.read();
    Serial.println(count);
  }
 
   }

Pages: [1]