Créer un projet Besoin d'aide ?
Montrer plus (2)
ClemensValens

ULN2003 shield [150162]

État : Terminé
5567
23
avis
26 mars 2015
150162-avatar.jpg

Simple Arduino shield with a ULN2003 and some connectors. The I2C port is also brought out on the main connector K1.

This shield was designed for promotional purposes to show off two connectors series from Phoenix Contact, the FMC0,5 0,5mm² push-in PCB connector and the MC1,5 1,5mm² PCB screw terminal block with lock&release.

MC1,5
FMC 0,5
 

This is the support page for this board from where you can download the accompanying sketch. Copy the code below into an empty Arduino sketch, compile and upload it to the board.

// Elektor project 150162
// Stepper motor example.
//
// My 6-wire stepper motor
// -----------------------
// Use multimeter to identify wires.
// - red & brown belong together, 76 ohms (+ white)
// - blue & yellow belong together, 76 ohms (+ white)
//
// red --UUU-+-UUU-- brown (-UUU- represents a coil)
//           |
//         white
//
// blue --UUU-+-UUU-- yellow
//            |
//          white
//
// Connector: white, white, red, blue, yellow, brown
//
// Wiring it to the shield
// -----------------------
// 2x white to V+ (one to K1, one to K2)
// brown - o7
// blue - o6
// red - o5
// yellow - o4
// Motor spins anti-clockwise.
//
// Swapping blue & yellow OR red & brown makes 
// the motor spin clockwise. Swapping both does 
// not change spinning direction
 
int outputs[4];
 
void setup(void) 
{
  Serial.begin(115200);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(13,OUTPUT);
}
 
void loop(void) 
{
  static int i=0;
  digitalWrite(10+i,LOW);
  outputs[i] = 0;
  i = (i+1)&0x03;
  outputs[i] = 1;
  digitalWrite(10+i,HIGH);
  for (int k=0; k<4; k++)
  {
    if (outputs[k]==0)
    {
      Serial.print("__");
    }
    else
    {
      Serial.print("--");
    }
    Serial.print(" ");
  }
  Serial.println();
  delay(100);
}
 
 
Tout lire
Afficher moins
Images

Chargement des commentaires...