i recently bought a new Arduino Micro to lessen the dimension of my little project. I developed the Code an the circuit on an Arduino UNO and it worked well. So I wanted to transfer all to the Micro but it didnt work right. So I tested to only run a DC-Motor with a H-Bridge. But the Motor does what it likes.
Its definitely right programmed and connected, it works on my UNO.
int motor_a=6;
int motor_b=5;
int motor_speed=3;
void setup()
{
 pinMode(motor_a, OUTPUT);
 pinMode(motor_b, OUTPUT);
}
void loop()
{
 digitalWrite(motor_a, HIGH);
 digitalWrite(motor_b, LOW);
 for(int i=0;i<256;i+=5)
 {
  analogWrite(motor_speed, i);
  delay(20);
 }
 for(int i=256;i>0;i-=5)
 {
  analogWrite(motor_speed, i);
  delay(20);
 }
Â
 digitalWrite(motor_a, LOW);
 digitalWrite(motor_b, HIGH);
 for(int i=0;i<256;i+=5)
 {
  analogWrite(motor_speed, i);
  delay(20);
 }
 for(int i=256;i>0;i-=5)
 {
  analogWrite(motor_speed, i);
  delay(20);
 }
}